Releases: OpenFn/language-http
Hide response body
To work alongside OpenFn.org's new :no_conosle
feature, we hide server responses in language-http
by default. The response body is added to state (usually in state.data
) and can be accessed by console.log(state.data)
or in a subsequent job state (from a flow or a timer job) if the project admin allows the use of console.log
. This prevents the leakage of sensitive data to those who shouldn't see it but are granted OpenFn.org project access.
Fix content-type suggestion in inline documentation
The inline docs were displaying "content-type": "json"
, which isn't valid. Updated across functions to use "application/json"
:
/**
* Make a POST request
* @public
* @example
* post("/myendpoint", {
* body: {"foo": "bar"},
* headers: {"content-type": "application/json"},
* authentication: {username: "user", password: "pass"},
* },
* function(state) {
* return state;
* }
* )
* @function
* @param {string} path - Path to resource
* @param {object} params - Body, Query, Headers and Authentication parameters
* @param {function} callback - (Optional) Callback function
* @returns {Operation}
*/
Hide params in log
v.2.4.4 exposed params, which is bad for shared accounts!
Re-releasing for Node6 compatibility
Removes parseCSV until a Node6 compatible function is written.
keep headers with keepCookies option
The keepCookies option allows for different auth schemes. By defaulting to also keep headers for later use, we can enable token auth with a post('/api/auth/sign_in', {params}, get({headers: state.data.__headers})
pattern
allow options with successCodes
post('/manage/person', {
formData: state => {
state.person.submit_type = 'save';
return state.person;
},
options: {
successCodes: [302],
},
})
allow use of formData
and upgrade to language-common#v0.3.0
raw request function exported
ultimate flexibility!
stringify server response
v2.1.2 fuller logs
increase verbosity of server responses
@santiagogak , I only made changes to the logs... return response
instead of just response.status
.
I was setting up a new project and found that in order to determine the error I had to go in and modify the language package. Not everyone has that option, so let's err on the side of verbosity.