feat: add examples to api (#5331)

Co-authored-by: Dean Sheather <dean@deansheather.com>
This commit is contained in:
Garrett Delfosse
2022-12-09 14:29:50 -05:00
committed by GitHub
co-authored by Dean Sheather
parent 6cc864c048
commit ca0374b94f
11 changed files with 252 additions and 26 deletions
+5 -1
View File
@@ -19,6 +19,10 @@ import (
"github.com/coder/coder/codersdk"
)
const (
tarMimeType = "application/x-tar"
)
func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
ctx := r.Context()
apiKey := httpmw.APIKey(r)
@@ -32,7 +36,7 @@ func (api *API) postFile(rw http.ResponseWriter, r *http.Request) {
contentType := r.Header.Get("Content-Type")
switch contentType {
case "application/x-tar":
case tarMimeType:
default:
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
Message: fmt.Sprintf("Unsupported content type header %q.", contentType),