File tree Expand file tree Collapse file tree 14 files changed +113
-16
lines changed Expand file tree Collapse file tree 14 files changed +113
-16
lines changed Original file line number Diff line number Diff line change 1
- export { default as findStatus } from './utils/find-status/index' ;
2
- export {
3
- default as findStatusByCode
4
- } from './utils/find-status/find-status-by-code' ;
5
- export {
6
- default as findStatusByKey
7
- } from './utils/find-status/find-status-by-key' ;
8
- export { default as validateHttpStatus } from './utils/validate-http-status' ;
9
1
export { default as HTTPStatusError } from './errors/http-status-error' ;
10
- export { default as isCreated } from './is-created' ;
11
- export { default as isOk } from './is-ok' ;
12
- export { default as isMovedPermanently } from './is-moved-permanently' ;
13
- export { default as isUnauthorized } from './is-unauthorized' ;
2
+ export * from './utils' ;
3
+ export * from './validators' ;
Original file line number Diff line number Diff line change
1
+ export { default as findStatus } from './find-status' ;
2
+ export { default as findStatusByCode } from './find-status/find-status-by-code' ;
3
+ export { default as findStatusByKey } from './find-status/find-status-by-key' ;
Original file line number Diff line number Diff line change 1
- import validateHttpStatus from './utils /validate-http-status' ;
1
+ import validateHttpStatus from '.. /validate-http-status' ;
2
2
3
3
/**
4
4
* @module isUnauthorized
Original file line number Diff line number Diff line change
1
+ export { default as validateHttpStatus } from './validate-http-status' ;
2
+
3
+ // 1×× Informational
4
+ export { default as isContinue } from './informational/is-continue' ;
5
+ export { default as isProcessing } from './informational/is-processing' ;
6
+ export {
7
+ default as isSwitchingProtocols
8
+ } from './informational/is-switching-protocols' ;
9
+
10
+ // 2×× Success
11
+ export { default as isCreated } from './success/is-created' ;
12
+ export { default as isOk } from './success/is-ok' ;
13
+
14
+ // 3×× Redirection
15
+ export {
16
+ default as isMovedPermanently
17
+ } from './redirection/is-moved-permanently' ;
18
+
19
+ // 4×× Client Error
20
+ export { default as isUnauthorized } from './client-error/is-unauthorized' ;
Original file line number Diff line number Diff line change
1
+ import validateHttpStatus from '../validate-http-status' ;
2
+
3
+ /**
4
+ * @module isContinue
5
+ * @description
6
+ * Validate HTTP Status code 100 type INFORMATIONAL
7
+ *
8
+ * @param {Integer } statusCode - The HTTP Status code
9
+ * @return {Boolean }
10
+ * @throws {HTTPStatusError } When the statusCode is different then 100
11
+ */
12
+ function isContinue ( statusCode ) {
13
+ return validateHttpStatus ( statusCode , 100 ) ;
14
+ }
15
+
16
+ export default isContinue ;
Original file line number Diff line number Diff line change
1
+ import validateHttpStatus from '../validate-http-status' ;
2
+
3
+ /**
4
+ * @module isProcessing
5
+ * @description
6
+ * Validate HTTP Status code 102 type INFORMATIONAL
7
+ *
8
+ * @param {Integer } statusCode - The HTTP Status code
9
+ * @return {Boolean }
10
+ * @throws {HTTPStatusError } When the statusCode is different then 102
11
+ */
12
+ function isProcessing ( statusCode ) {
13
+ return validateHttpStatus ( statusCode , 102 ) ;
14
+ }
15
+
16
+ export default isProcessing ;
Original file line number Diff line number Diff line change
1
+ import validateHttpStatus from '../validate-http-status' ;
2
+
3
+ /**
4
+ * @module isSwitchingProtocols
5
+ * @description
6
+ * Validate HTTP Status code 101 type INFORMATIONAL
7
+ *
8
+ * @param {Integer } statusCode - The HTTP Status code
9
+ * @return {Boolean }
10
+ * @throws {HTTPStatusError } When the statusCode is different then 101
11
+ */
12
+ function isSwitchingProtocols ( statusCode ) {
13
+ return validateHttpStatus ( statusCode , 101 ) ;
14
+ }
15
+
16
+ export default isSwitchingProtocols ;
Original file line number Diff line number Diff line change 1
- import validateHttpStatus from './utils /validate-http-status' ;
1
+ import validateHttpStatus from '.. /validate-http-status' ;
2
2
3
3
/**
4
4
* @module isMovedPermanently
Original file line number Diff line number Diff line change 1
- import validateHttpStatus from './utils /validate-http-status' ;
1
+ import validateHttpStatus from '.. /validate-http-status' ;
2
2
3
3
/**
4
4
* @module isCreated
Original file line number Diff line number Diff line change 1
- import validateHttpStatus from './utils /validate-http-status' ;
1
+ import validateHttpStatus from '.. /validate-http-status' ;
2
2
3
3
/**
4
4
* @module isOk
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import { isContinue } from '../src' ;
2
+
3
+ describe ( 'isContinue' , ( ) => {
4
+ test ( 'it should receive true when pass status 100' , ( ) => {
5
+ expect ( isContinue ( 100 ) ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+
8
+ test ( 'it should throw Error when pass status different than 100' , ( ) => {
9
+ const received = isContinue ( 300 ) ;
10
+ expect ( received . message ) . toBe ( 'Expected a 100 response.' ) ;
11
+ } ) ;
12
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { isProcessing } from '../src' ;
2
+
3
+ describe ( 'isProcessing' , ( ) => {
4
+ test ( 'it should receive true when pass status 102' , ( ) => {
5
+ expect ( isProcessing ( 102 ) ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+
8
+ test ( 'it should throw Error when pass status different than 102' , ( ) => {
9
+ const received = isProcessing ( 300 ) ;
10
+ expect ( received . message ) . toBe ( 'Expected a 102 response.' ) ;
11
+ } ) ;
12
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { isSwitchingProtocols } from '../src' ;
2
+
3
+ describe ( 'isSwitchingProtocols' , ( ) => {
4
+ test ( 'it should receive true when pass status 101' , ( ) => {
5
+ expect ( isSwitchingProtocols ( 101 ) ) . toBeTruthy ( ) ;
6
+ } ) ;
7
+
8
+ test ( 'it should throw Error when pass status different than 101' , ( ) => {
9
+ const received = isSwitchingProtocols ( 300 ) ;
10
+ expect ( received . message ) . toBe ( 'Expected a 101 response.' ) ;
11
+ } ) ;
12
+ } ) ;
You can’t perform that action at this time.
0 commit comments