Skip to content

Commit

Permalink
[Task] #43 check that body is ignored for GET in request
Browse files Browse the repository at this point in the history
  • Loading branch information
Type-Style committed Mar 10, 2024
1 parent 81155fe commit 42d64a9
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion src/tests/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import axios from 'axios';
import axios, { AxiosError } from 'axios';
import qs from 'qs';

// random data of 0.75Kb pre GZIP
const randomData = qs.stringify({
randomData: 'zIakHvSaXDdLtaPaL02LhGr4Fk6hzXF7tELeR733YZyyye1fnjNzrSlHgqcHU8BKqvE5Mi4B7iHIEdqjTelpoWyaqXqX8l6LzOvROAkTF4lrLXLD1oMHwDL9hnjR0P7g0BB2DqagKkoEYD4TmXeAXT9PbevbirWnOEzmIgSv65SlsNTRFYhmzWl93twXEBNclHTCTnZpf6diWoo8FsXZR49pe9v8J1paalh2LlbNF4ZUxMxNpSvSTRHxvkYo0TMpd0NqUSSLduLIWcE1jhCWnmHhsbohDZjFfMhVS8IFvCiu7rxfuWgwMPqD9FcBR79eqJBy2tjDMqA9S1k9k50AkbOQ6USVfEuqOtocqXonTvC3Jml90KYSs0gX4SSTFHofpMtbWIdkuKqZbitQjsPSBpTx27dhFZd8zT4erdE1ltHnq83pjEj9hQYqatmdzQGYnOyh9YDt8i1IJpk4DX83DLzw3QhaFPgZFq98SOj4ILytmBMIqOtD464aF8PKGq6g7dVqYOtyF2FwyY0xgA7LjGaFzaCDjnGEcPIMRc2tcorsuRPKUI0zcde1gYPsn4WKaKUp87hJd1YtorzCXPfvivfGGL5v1XaSzApc9BbZpbxcpTOi4Pgvx7hNafUcaCr6kcjp4JVYSktnnGCwEplgGEF8uCELsEBUi9LNhgsnwgoRh55TaJfcaFfGfYLokXYEgiyOwYhhdEY3kfjHZWAyFS4owCR6nMJGOGMHrQi1fBefdp28PQGwgELix5Vf8j6P'
});

describe('Server Status', () => {
it('The server is running', async () => {
Expand All @@ -12,5 +18,25 @@ describe('Server Status', () => {

expect(serverStatus).toBe(200);
})

it('server is ignoring requests with large body', async () => {
let serverStatus;
try {
const response = await axios.request({
url: 'http://localhost:80/',
method: 'GET',
data: randomData,
});
serverStatus = response.status;
} catch (error) {
console.error(error);
}

expect(serverStatus).toBe(200);
})

})




0 comments on commit 42d64a9

Please sign in to comment.