-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): adds check for http status 304 (#311)
* feat(api): adds check for http status 304 http status code should be considered successful * feat(api): adds tests for http status code 304
- Loading branch information
1 parent
3b17fb0
commit c0adf51
Showing
4 changed files
with
25 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
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,20 @@ | ||
const argv = require('minimist')(process.argv.slice(2), { | ||
alias: { | ||
port: 'p' | ||
} | ||
}) | ||
const http = require('http') | ||
const server = http.createServer((req, res) => { | ||
console.log(req.method) | ||
if (req.method === 'GET') { | ||
res.writeHead(304).end('All good\n\n') | ||
} else { | ||
res.end() | ||
} | ||
}) | ||
const port = argv.port || 9000 | ||
setTimeout(() => { | ||
server.listen(port) | ||
console.log('listening at port %d', port) | ||
}, 5000) | ||
console.log('sleeping for 5 seconds before starting') |