feat(scully): allow specify headers when using the JSON plugin#140
Merged
aaronfrost merged 1 commit intoscullyio:masterfrom Jan 4, 2020
d-koppenhagen:feat/json-plugin-optional-headers
Merged
feat(scully): allow specify headers when using the JSON plugin#140aaronfrost merged 1 commit intoscullyio:masterfrom d-koppenhagen:feat/json-plugin-optional-headers
aaronfrost merged 1 commit intoscullyio:masterfrom
d-koppenhagen:feat/json-plugin-optional-headers
Conversation
user can specify a `headers` object in ths `scully.config.js`. This headers will be passed throught the request when calling the specified endpoint. Closes #137
Contributor
Author
|
Unfortunatly I couln't find any test specs which I could extend. Also I haven't had the chance to test this against a real API which needs a specific header. |
aaronfrost
reviewed
Jan 4, 2020
| rawData.map(row => deepGet(conf[param.part].property, row)) | ||
| ); | ||
| return httpGetJson(url, { | ||
| headers: conf[param.part].headers, |
Contributor
There was a problem hiding this comment.
Does this error if there aren't any provided? Does it work without anything?
Contributor
Author
There was a problem hiding this comment.
hmm good question I currently don't know how to test it locally ^^ -- probably I need to add || {} to it in case it's null or undefined. An empty object should be fine I think.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #137
What is the new behavior?
Users can specify a
headersobject in thsscully.config.js.This headers will be passed throught the request when calling the specified endpoint.
Does this PR introduce a breaking change?
Other information
I added the
requestmodule instead of usinghttpandhttpsand distinguish between this ones as it will abstract this already and allows to specify the options likeheaderswithout the need to pass a specific options object and splitting the URL manually intohost,pathand so on.