[BUG] если кодек не найден для переданного контент тайма отдавать спец ошибку #191

Closed
opened 2024-11-24 08:51:04 +03:00 by vtolstov · 1 comment
Owner

Если кодек не найден отдавать
WriteHeader(http.StatusUnsupportedMediaType)

Если кодек не найден отдавать WriteHeader(http.StatusUnsupportedMediaType)
atolstikhin was assigned by vtolstov 2024-11-24 09:10:00 +03:00
Member

handler.go

 99 |     return func(w http.ResponseWriter, r *http.Request) {
100 |    	ct := DefaultContentType
101 |     	if htype := r.Header.Get(metadata.HeaderContentType); htype != "" {
102 |    		ct = htype
103 | + 	} else {
104 | + 		w.WriteHeader(http.StatusUnsupportedMediaType)
105 | + 		return
106 | + 	}
...
handler.go ``` 99 | return func(w http.ResponseWriter, r *http.Request) { 100 | ct := DefaultContentType 101 | if htype := r.Header.Get(metadata.HeaderContentType); htype != "" { 102 | ct = htype 103 | + } else { 104 | + w.WriteHeader(http.StatusUnsupportedMediaType) 105 | + return 106 | + } ... ```
Sign in to join this conversation.
No Milestone
No project
No Assignees atolstikhin
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unistack-org/micro-server-http#191
No description provided.