Skip to content

Releases: ctimmerm/axios-mock-adapter

v2.0.0

05 Aug 11:30
113656e
Compare
Choose a tag to compare

Breaking Changes 💥

  • Drop node versions lower than v18 (#390)

  • Change the parameters of the methods to align it to the one of axios. (#387)
    The last parameter must be a config object with {params, headers} instead of just the headers.
    If you've always only used two parameters, you won't have to change anything.

    Methods with data param:

    • mock.onPost(url, data, headers) > mock.onPost(url, data, {params, headers})
    • mock.onPut(url, data, headers) > mock.onPost(url, data, {params, headers})
    • mock.onPatch(url, data, headers) > mock.onPatch(url, data, {params, headers})
    • mock.onAny(url, data, headers) > mock.onAny(url, {data, params, headers})

    Methods without data param:

    • mock.onGet(url, {params}, headers) > mock.onGet(url, {params, headers})
    • mock.onDelete(url, {params}, headers) > mock.onDelete(url, {params, headers})
    • mock.onHead(url, {params}, headers) > mock.onHead(url, {params, headers})
    • mock.onOptions(url, {params}, headers) > mock.onOptions(url, {params, headers})

    An error is reported if one accidentally passes the headers directly instead of `{headers: {}}.

    e.g. Error: Invalid config property Header-test provided to onPatch. Config: {"Header-test":"test-header"}

v1.22.0

11 Sep 08:32
4492f3c
Compare
Choose a tag to compare
  • Helper for delay in milliseconds (#312)
    mock.delayInMs(200).onGet("/foo").reply(200);
    mock.delayInMs(0).onGet("/bar").reply(200);

v1.21.4

01 Apr 16:45
60793dd
Compare
Choose a tag to compare
  • Fix type error (#368)
  • Test that the types are valid (#369)

v1.21.3

26 Mar 21:32
c504421
Compare
Choose a tag to compare
  • Fix passthrough support with axios 1.2 (#363)
  • Fix type exports (#364)
  • Update devDependencies (#366, #358)

v1.21.2

10 Aug 09:04
Compare
Choose a tag to compare
  • Use AxiosError constructor to create axios errors if available, this restores axios v0.27 compatibility (1d83731)

v1.21.1

01 Jun 13:23
Compare
Choose a tag to compare
  • Correctly include UMD builds in npm package

v1.21.0

01 Jun 13:22
Compare
Choose a tag to compare
  • Added support for LINK and UNLINK HTTP methods (a22ffe5)
  • Handle params and payloads on delete requests (d0e7081)
  • Vendor isBlob package to get rid of arrow function (e1700fd)

v1.20.0

13 Aug 06:30
Compare
Choose a tag to compare
  • Expose originalAdapter in TypeScript types (e6b2d2f)
  • Adopt the official behavior of validateStatus and always return an error instance on rejection (43e35b6)
  • Ensure that an instance is provided to mock (a326853)
  • Allow Blob responses (8dd3039)

v1.19.0

25 Oct 21:09
Compare
Choose a tag to compare
  • Add toJSON method to axios errors (a14b283)
  • Create onNoMatch=throwException option (a52b450)
  • Support asymmetricMatch in TypeScript (1a22ea2)
  • Handle request with undefined url (78fe012)
  • Add onNoMatch: "throwException" to types (855c8a5)
  • fix responseURL case (95d2aeb)

v1.18.2

18 Jul 08:50
Compare
Choose a tag to compare