Explain maxContentLength and fix test

This commit is contained in:
Rikki Gibson 2018-05-21 15:48:23 -07:00
Родитель ff5bf45512
Коммит 254788a4fc
2 изменённых файлов: 5 добавлений и 21 удалений

Просмотреть файл

@ -105,7 +105,8 @@ export class AxiosHttpClient implements HttpClient {
transformResponse: undefined,
validateStatus: () => true,
withCredentials: true,
maxContentLength: 1024*1024*1024*10,
// Workaround for https://github.com/axios/axios/issues/1362
maxContentLength: 1024 * 1024 * 1024 * 10,
responseType: httpRequest.rawResponse ? (isNode ? "stream" : "blob") : "text",
cancelToken
};

Просмотреть файл

@ -74,29 +74,12 @@ describe("axiosHttpClient", () => {
assert.strictEqual(responseBody, expectedResponseBody);
});
it("should throw for awaited 404", async () => {
it("should return a response instead of throwing for awaited 404", async () => {
const request = new WebResource(`${baseURL}/nonexistent`, "GET");
const httpClient = new AxiosHttpClient();
try {
await httpClient.sendRequest(request);
assert.fail("Expected error to be thrown.");
} catch (error) {
should(error).be.instanceof(Error);
should(error).not.be.instanceof(assert.AssertionError);
}
});
it("should reject for promised 404", async () => {
const request = new WebResource(`${baseURL}/nonexistent`, "GET");
const httpClient = new AxiosHttpClient();
try {
await httpClient.sendRequest(request);
} catch (err) {
should(err).be.instanceof(Error);
should(err).not.be.instanceof(assert.AssertionError);
}
const response = await httpClient.sendRequest(request);
assert(response);
});
it("should allow canceling requests", async function() {