-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98cbc9c
commit 5fc1d95
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |