-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/server/api: Return 405s for non-GET requests
We don't want folks POSTing, etc. to this server. If they do, this commit will return the appropriate response status code. Also add support for HEAD requests and start setting Content-Length and Content-Type ourselves instead of leaning on Go's autodetection [1]. The application/json media type is from [2]. [1]: https://golang.org/pkg/net/http/#ResponseWriter [2]: https://tools.ietf.org/html/rfc8259#section-1.2
- Loading branch information
Showing
2 changed files
with
131 additions
and
24 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