-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor] support custom HTTP status code (#605)
* Added 404 and 410 handler * Added 404 logic to koa * Added more redirect status codes * Added more custom html display status codes * Added status codes to all 3 server implementations * Added express tests * fix http status code dependency * Updated tests for full coverage
- Loading branch information
1 parent
9dd2394
commit 85c00d8
Showing
10 changed files
with
220 additions
and
33 deletions.
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 @@ | ||
"use strict"; | ||
|
||
const HttpStatusCodes = require("http-status-codes"); | ||
|
||
module.exports = { | ||
// Status codes where we might want to keep custom html | ||
displayHtml: { | ||
[HttpStatusCodes.NOT_FOUND]: true, | ||
[HttpStatusCodes.GONE]: true, | ||
[HttpStatusCodes.SERVICE_UNAVAILABLE]: true | ||
}, | ||
|
||
// Status codes where we want to redirect the user | ||
redirect: { | ||
[HttpStatusCodes.MOVED_PERMANENTLY]: true, | ||
[HttpStatusCodes.MOVED_TEMPORARILY]: true, | ||
[HttpStatusCodes.PERMANENT_REDIRECT]: true, | ||
[HttpStatusCodes.TEMPORARY_REDIRECT]: true | ||
} | ||
}; |
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
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