@axway/requester

Module for HTTP requests

Usage no npm install needed!

<script type="module">
  import axwayRequester from 'https://cdn.skypack.dev/@axway/requester';
</script>

README

axway-requester

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

Configuration

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.

Author

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

Changes

4.0.7

  • 7105: Removed body payload from DEBUG level log which improves performance.

4.0.6

  • 6934: Internal refactoring around code style.

4.0.5

  • 6315: Internal chore.

4.0.4

  • 6187: Fix README.md input parameter documentation.

4.0.3

  • 6116: Internal cleanup chore.

4.0.2

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

4.0.1

  • 6074: Internal CI chore

4.0.0

  • 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.

3.2.4

  • 5711: Internal cleanup of npm scripts.

3.2.3

  • 5708: Internal changes to update mocha configuration

3.2.2

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

3.2.1

  • 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.

3.2.0

  • 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.

3.1.1

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

3.1.0

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

3.0.0

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

2.1.0

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

2.0.0

  • 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.

1.1.2

  • 4757: Changed SCM repository and associated internal cleanup.

License

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.