You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not ideal, when your API requests a specific content-type, which would mean that the content-type has to be set on all http.res functions. This is not ideal when having large K6 test sets.
Feature Description
A Provide the option to define/overwrite the request header with another another default, for when none is specified.
Suggested Solution (optional)
Allow the definition of default request headers in the "option".
export default function () {
// our HTTP request, note that we are saving the response to res, which can be accessed later
const res = http.get('http://test.k6.io');
sleep(1);
const checkRes = check(res, {
'status is 200': (r) => r.status === 200,
'response body': (r) => r.body.indexOf('Feel free to browse') !== -1,
});
}
The text was updated successfully, but these errors were encountered:
Thanks for making this issue! I think it can be classified as a sub-set of #761, so I'll close this one in favor of it.
Take a look at the comment I left there today (#761 (comment)) with some workarounds for the issue you're having, until we get around to fixing it properly.
The K6 requests always seems to fallback to the request header "application/x-www-form-urlencoded", when none is specified. This is the default behavior of k6, as described in https://k6.io/docs/javascript-api/k6-http/post-url-body-params.
This is not ideal, when your API requests a specific content-type, which would mean that the content-type has to be set on all http.res functions. This is not ideal when having large K6 test sets.
Feature Description
A Provide the option to define/overwrite the request header with another another default, for when none is specified.
Suggested Solution (optional)
Allow the definition of default request headers in the "option".
Example
The text was updated successfully, but these errors were encountered: