Module for HTTP requests


4.0.64 months ago3 years agoMinified + gzip package size for @axway/requester in KB



Wrapper around request to provide unified approach of using it across other packages.


This module export a wrapper function around request with the following parameters:

  • uri - the request location
  • headers - the request headers
  • method - the HTTP method
  • body - the request body
  • options - the options to configure the request

Supported Options

Some of the options are based on the request library options specified here - https://github.com/request/request#requestoptions-callback The default values used are:

const requestOptions = {
    followRedirect: true,
    followAllRedirects: true,
    followOriginalHttpMethod: true,
    strictSSL: true,
    maxRedirects: 10,
    gzip: true,
    encoding: null

Additional options could be provided as well:

  • rawBuffer - if true the requester returns raw Buffer, if false it does "smart" decoding.


Axway R&D support@axway.com https://axway.com



  • #6315: Internal chore.


  • #6187: Fix README.md input parameter documentation.


  • #6116: Internal cleanup chore.


  • #6114: Refactor code for style, security and performance improvements.


  • #6074: Internal CI chore


  • #5764: Add support for request and response logging using optional logger provided in options.
  • #5764: Breaking change: Removed error property from the response which was always going to be undefined.


  • #5711: Internal cleanup of npm scripts.


  • #5708: Internal changes to update mocha configuration


  • #5707: Internal cleanup to code coverage during build process.


  • #5622: Fix regression introduced in 3.1.1 where the format of the data returned would change depending on the value of the response rather than just the content-type header. Now, when content type is "application/json" and rawBuffer is false, a JSON value will be returned, otherwise it will throw an error while parsing. For other known text-like content-types including "application/xml", a valid string will always be returned. For every other case, a Buffer will be consistently returned.


  • #5630: Support outbound requests with object body as form data including files and streams when using multipart/form-data content type.
  • #5630: Add additional validation to individual payload fields to provide better error messages when using application/x-www-form-urlencoded content type.


  • #5622: Fixed error when the Accept header was a derivative of "application/json" and 0 length response body was returned.


  • #5329: Support outbound requests with object body as form data when using application/x-www-form-urlencoded content type.


  • #5432: Previously, the requester was encoding and decoding the payload assuming it was of type application/json. Now, it respects the provided content type.


  • #5364: Support insecure SSL option on outbound requests insecureSSL.


  • #4919: Requester now is just a tiny wrapper around the request module. It has no business logic within it.

  • #4918: Breaking change: Previously, if a request to a method which documented an optional query parameter with a default value and was not supplied to the request, the default value would be sent to the service instead. Now, default values are not used when sending query parameters.

  • #4918: Breaking change: Removed support for the following credential configuration values. Authorization parameters should be provided in authorizationData instead:

    • x-vendor-openapi-username
    • x-vendor-openapi-password
    • x-vendor-openapi-key
    • x-vendor-openapi-token
  • #4918: Added support for authorization parameters, replacing x-vendor-openapi- global configuration. These parameters are generated based on the security parameter in the original swagger document.


  • #4757: Changed SCM repository and associated internal cleanup.


This code is proprietary, closed source software licensed to you by Axway. All Rights Reserved. You may not modify Axway’s code without express written permission of Axway. You are licensed to use and distribute your services developed with the use of this software and dependencies, including distributing reasonable and appropriate portions of the Axway code and dependencies. Except as set forth above, this code MUST not be copied or otherwise redistributed without express written permission of Axway. This module is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement (General Conditions) located here: https://support.axway.com/en/auth/general-conditions; EXCEPT THAT IF YOU RECEIVED A FREE SUBSCRIPTION, LICENSE, OR SUPPORT SUBSCRIPTION FOR THIS CODE, NOTWITHSTANDING THE LANGUAGE OF THE GENERAL CONDITIONS, AXWAY HEREBY DISCLAIMS ALL SUPPORT AND MAINTENANCE OBLIGATIONS, AS WELL AS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO IMPLIED INFRINGEMENT WARRANTIES, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND YOU ACCEPT THE PRODUCT AS-IS AND WITH ALL FAULTS, SOLELY AT YOUR OWN RISK. Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.