MCPcopy Create free account
hub / github.com/PuerkitoBio/fetchbot / ContentType

Method ContentType

handler.go:202–207  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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").
202func (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.

Callers 2

TestMuxFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestMuxFunction · 0.64