kirgudkov/rest-api-helper

Unexpected behaviour when content-type is set as global

Closed this issue · 1 comments

config example:

{
  "baseURL": "url",
  "logger": true,
  "statusDescription": {
    "200": "OK",
    "401": "Invalid API token"
  },
  "successStatus": [
    200
  ],
  "request": {
    "someQuery": {
      "method": "post",
      "url": "/some_query",
    }
}

fetch:

    const field = 'value';
    const response = await RestApiHelper.build('someQuery')
      .withBody({ field })
      .fetch();
    return response.body;

expected:

Body will be translated in encoded format.

behaviour:

Content-Type is ignored.

error location

_isFormURLEncoded method in Options.js

fixed in pr #4