* Sends POST request to API. * * ```js * I.sendPostRequest('/api/users.json', { "email": "user@user.com" }); * * // To mask the payload in logs * I.sendPostRequest('/api/users.json', secret({ "email": "user@user.com" })); * * ``` * * @param {*} url * @param {*} [payl
(url, payload = {}, headers = {})
| 342 | * @returns {Promise<*>} response |
| 343 | */ |
| 344 | async sendPostRequest(url, payload = {}, headers = {}) { |
| 345 | const request = { |
| 346 | baseURL: this._url(url), |
| 347 | method: 'POST', |
| 348 | data: payload, |
| 349 | headers, |
| 350 | } |
| 351 | |
| 352 | if (this.options.maxContentLength) { |
| 353 | request.maxContentLength = this.options.maxContentLength |
| 354 | request.maxBodyLength = this.options.maxContentLength |
| 355 | } |
| 356 | |
| 357 | return this._executeRequest(request) |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Sends PATCH request to API. |
no test coverage detected