Skip to content

Version 4.0.0

Compare
Choose a tag to compare
@Avaq Avaq released this 06 Apr 10:04
· 11 commits to master since this release
23813ce

⚠️ Breaking Changes

NOTE: These changes may not affect you if you were only using the higher level
functions exposed from this library, which is quite a common scenario.

  • #11 The request function has been removed in favour of Request and
    sendRequest.
  • #11 The return value from retrieve, sendJson, and sendForm was changed
    from a Future of an IncommingMessage to a Future of the new Response type.
    If you were using bufferResponse or autoBufferResponse, then you don't
    have to change your code, because:
  • #11 The bufferResponse and autoBufferResponse now take a Response
    instead of an IncomingMessage.

New Features

  • #11 A new sendRequest function has taken the place of the request function.
    This function takes its request options as a single argument.
  • #11 A new Request type (and constructor) was added. This is used to
    represent an HTTP request in a pure way. Values of this type are used as input
    for the sendRequest function.
  • #11 A new Response type (and constructor) was added. This is used to
    represent a request/response pair.
  • #11 A matchStatus function was added for matching against a Response based
    on the response status code.
  • #11 Various utility functions for building automatic redirection chains were
    added. These are redirectAnyRequest, redirectIfGetMethod,
    redirectUsingGetMethod, retryWithoutCondition, defaultRedirectionPolicy,
    aggressiveRedirectionPolicy, followRedirectsWith, and followRedirects.
  • #11 New functions were added to complement the existing response-consumption
    functions like bufferResponse and autoBufferResponse with versions that
    take an IncomingMessage directly. These are bufferMessage and
    autoBufferMessage respectively.