Skip to content

Commit

Permalink
sort headers
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jan 23, 2024
1 parent ffc359f commit 6493f24
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,29 @@ export function generateTests(
name: functionName,
test: async () => {
const response = fletch('canister', request);
const filteredHeaders = response.headers.filter(
([name]) =>
name !== 'x-ic-streaming-response' &&
name !== 'content-length' &&
name !== 'date'
);
const filteredHeaders = response.headers
.filter(
([name]) =>
name !== 'x-ic-streaming-response' &&
name !== 'content-length' &&
name !== 'date'
)
.sort();
const processedResponse = {
status: response.status,
headers: filteredHeaders,
body: response.body
};
const filteredExpectedHeaders =
expectedResponse.headers.sort();
const processedExpectedResponse = {
status: expectedResponse.status,
headers: filteredExpectedHeaders,
body: expectedResponse.body
};
const valuesAreEqual = deepEqual(
processedResponse,
expectedResponse
processedExpectedResponse
);

return { Ok: valuesAreEqual };
Expand Down

0 comments on commit 6493f24

Please sign in to comment.