Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
#261 - processResponse support blob & Co
Browse files Browse the repository at this point in the history
- fix tests
  • Loading branch information
cbek authored and fabien0102 committed May 4, 2020
1 parent b258d7b commit 5d26fee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Get.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ describe("Get", () => {
it("should render if we have an error", async () => {
nock("https://my-awesome-api.fake")
.get("/")
.reply(401, "Go away!");
.reply(401, "Go away!", { "content-type": "text/plain" });

const children = jest.fn();
children.mockReturnValue(<div />);
Expand Down
2 changes: 1 addition & 1 deletion src/Poll.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ describe("Poll", () => {
},
})
.get("/")
.reply(200, { data: "hello" }, { "x-polling-index": "1" });
.reply(200, { data: "hello" }, { "x-polling-index": "1", "content-type": "application/json" });

const children = jest.fn();
children.mockReturnValue(<div />);
Expand Down
5 changes: 4 additions & 1 deletion src/util/processResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export const processResponse = async (response: Response) => {
responseError: true,
};
}
} else if ((response.headers.get("content-type") || "").includes("text/plain")) {
} else if (
(response.headers.get("content-type") || "").includes("text/plain") ||
(response.headers.get("content-type") || "").includes("text/html")
) {
try {
return {
data: await response.text(),
Expand Down

0 comments on commit 5d26fee

Please sign in to comment.