-
-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update/clarify interceptor.reply param juggling. #1520
Commits on May 1, 2019
-
chore: update/clarify interceptor.reply param juggling.
Based on conversation https://github.com/nock/nock/pull/1517/files#r280139478. The `arguments.length <= 2` was confusing/misleading, and clearing the `rawHeaders` clarifies the method's intention to anyone digging around, plus reduces the changes for bugs in the future.
Configuration menu - View commit details
-
Copy full SHA for c87fa52 - Browse repository at this point
Copy the full SHA c87fa52View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b92974 - Browse repository at this point
Copy the full SHA 9b92974View commit details
Commits on May 5, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 6ba0f5c - Browse repository at this point
Copy the full SHA 6ba0f5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4cae0ba - Browse repository at this point
Copy the full SHA 4cae0baView commit details
Commits on May 6, 2019
-
Configuration menu - View commit details
-
Copy full SHA for be2b310 - Browse repository at this point
Copy the full SHA be2b310View commit details -
Add statusCodeInt helper too common.
This commit only includes the implementation and tests. Callers are to follow, but I didn’t want to muddy commit history.
Configuration menu - View commit details
-
Copy full SHA for 14fe6d0 - Browse repository at this point
Copy the full SHA 14fe6d0View commit details -
Simplify Interceptor.reply signature.
Includes breaking changes. - When a status code is provided followed by a function, the function returns the body. No magic. - When a function is provided on its own, it _MUST_ return an array of `status, [body, [headers]]`. Again, no magic. This change uses errors to enforce the following two signatures: `.reply(status, [body, [headers]])` where `body` is any of the existing types that can result in a scalar value. `.reply(() => [status, body = ‘’, headers = {}])` where the callback is called using the existing mechanics. #### Breaking changes - There is no longer a default value for the response status code. It must be provided as the first arg of `reply` or the first element in the returned array if using the single-function style. - `.reply()` will now throw an error - Status code args will throw an error if they cannot be cast to ints. - The single-function style callback **MUST** return an array with a length of 1-3 or else an error is thrown. - If **NOT** using the single-function style callback, the resulting body will never be treated as a special value for status code or headers, it will always result to the responses body value. - `reply(200, () => [400, ‘foo’])` - **previous result** status: 400 body: ‘foo’ - **new result** status: 200 body: “[400, ‘foo’]” - `reply(200, () => [400])` - **previous result** status: 400 body: “[400]” - **new result** status: 200 body: “[400]”
Configuration menu - View commit details
-
Copy full SHA for 9913f68 - Browse repository at this point
Copy the full SHA 9913f68View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7d1a3be - Browse repository at this point
Copy the full SHA 7d1a3beView commit details -
Bugfix Interceptor.filteringPath
Calling `filteringPath` on the intercept instance was broken as the transform fn set on the scope had the wrong name. Found when looking at Uncovered lines in coveralls.
Configuration menu - View commit details
-
Copy full SHA for 5baf9ed - Browse repository at this point
Copy the full SHA 5baf9edView commit details -
Configuration menu - View commit details
-
Copy full SHA for 833dae2 - Browse repository at this point
Copy the full SHA 833dae2View commit details
Commits on May 8, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 2ee5821 - Browse repository at this point
Copy the full SHA 2ee5821View commit details -
Prefer to not cast and instead have a hard requirement for the arg to already be an int. Allow status code to not be provided and default to 200 again.
Configuration menu - View commit details
-
Copy full SHA for f6f1f0b - Browse repository at this point
Copy the full SHA f6f1f0bView commit details -
Allow native falsy values as body.
While `false` and `null` are falsy, they are valid JSON value so they should be returned as a strings that JSON.parse would convert back to native values. Should fix nock#1446
Configuration menu - View commit details
-
Copy full SHA for b2ad0ad - Browse repository at this point
Copy the full SHA b2ad0adView commit details -
Configuration menu - View commit details
-
Copy full SHA for af42783 - Browse repository at this point
Copy the full SHA af42783View commit details -
Configuration menu - View commit details
-
Copy full SHA for cb272d4 - Browse repository at this point
Copy the full SHA cb272d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 13f347b - Browse repository at this point
Copy the full SHA 13f347bView commit details -
CR feedback. Separate two interceptor reply fns.
Use different attribute names for the reply functions that return a body vs return an array for the whole response (dynamic). Rejigger RequestOverrider.end to return early based which flow is used. It would be nice if this method was split up into more pure functions to reduce the complexity.
Configuration menu - View commit details
-
Copy full SHA for c491360 - Browse repository at this point
Copy the full SHA c491360View commit details -
Add test to cover a JSON array for the body.
This is a regression test for nock#1208.
Configuration menu - View commit details
-
Copy full SHA for 98eb511 - Browse repository at this point
Copy the full SHA 98eb511View commit details -
Configuration menu - View commit details
-
Copy full SHA for 14cf473 - Browse repository at this point
Copy the full SHA 14cf473View commit details
Commits on May 19, 2019
-
Configuration menu - View commit details
-
Copy full SHA for 7043064 - Browse repository at this point
Copy the full SHA 7043064View commit details
Commits on May 20, 2019
-
Configuration menu - View commit details
-
Copy full SHA for f317877 - Browse repository at this point
Copy the full SHA f317877View commit details