Skip to content

regression: ky aborting in 1.8.0 #689

@curtdept

Description

@curtdept

When using options ky seems to abort, provide no return and wont process any further requests.

example:

import HttpRequestMock from "http-request-mock";
import ky from "ky";

const mockHttp = HttpRequestMock.setupForFetch();

mockHttp.post("https://api.site.test/call", {
  data: { payload: "testing" },
});

async function test() {
  const test1 = await ky.post(`https://api.site.test/call`, {
    json: { testBody: "test" },
  });
  console.log("test1", test1);

  //   const test2 = await ky.post(`https://api.site.test/call`);
  //   console.log("test2:", test2);
}

test()
  .then(() => {
    process.exit(0);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });

Scenarios:

  • when running test1 alone, no return, seem to just skip
  • when running test1 and test2, no return, both skip
  • when running test2 alone, returns as expected

if I comment this out, all scenarios work
https://github.com/sindresorhus/ky/blob/main/source/core/Ky.ts#L70-L72

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions