Skip to content

Commit

Permalink
axios added
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Jul 8, 2024
1 parent 98cbc9c commit 5fc1d95
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build": "npm run start",
"test": "npm run test-400",
"start-test-server": "node backend.js &",
"test-400": "curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/ | ( grep -q 400 || exit 1 )"
"test-400": "test.js"
},
"keywords": [
"proxy",
Expand All @@ -23,6 +23,7 @@
"@mercuryworkshop/epoxy-transport": "^2.0.6",
"@titaniumnetwork-dev/ultraviolet": "^3.1.5",
"@tomphttp/bare-server-node": "^2.0.3",
"axios": "^1.7.2",
"babel": "^6.23.0",
"express": "^4.19.2",
"helmet": "^7.1.0",
Expand Down
19 changes: 19 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const axios = require('axios');

async function testServerResponse() {
try {
const response = await axios.get('http://localhost:8080/');
if (response.status === 400) {
console.log('Server responded with status code 400. Test passed.');
process.exit(0); // Exit with success
} else {
console.error(`Expected status code 400 but received ${response.status}. Test failed.`);
process.exit(1); // Exit with failure
}
} catch (error) {
console.error('Error while testing server response:', error.message);
process.exit(1); // Exit with failure
}
}

testServerResponse();

0 comments on commit 5fc1d95

Please sign in to comment.