ContentType sets a criteria based on the Content-Type header for the Response Handler. Its Handler will only be called if it has this content type, ignoring any additional parameter on the Header value (following the semicolon, i.e. "text/html; charset=utf-8").
(ct string)
| 200 | // Its Handler will only be called if it has this content type, ignoring any additional |
| 201 | // parameter on the Header value (following the semicolon, i.e. "text/html; charset=utf-8"). |
| 202 | func (r *ResponseMatcher) ContentType(ct string) *ResponseMatcher { |
| 203 | r.mux.mu.Lock() |
| 204 | defer r.mux.mu.Unlock() |
| 205 | r.contentType = ct |
| 206 | return r |
| 207 | } |
| 208 | |
| 209 | // Status sets a criteria based on the Status code of the response for the Response Handler. |
| 210 | // Its Handler will only be called if the response has this status code. |