MCPcopy Create free account
hub / github.com/imroc/req / SetErrorResult

Method SetErrorResult

request.go:432–438  ·  view source on GitHub ↗

SetErrorResult set the result that response body will be unmarshalled to if no error occurs and Response.ResultState() returns ErrorState, by default it requires HTTP status `code >= 400`, you can also use Client.SetResultStateCheckFunc to customize the result state check logic.

(err any)

Source from the content-addressed store, hash-verified

430// it requires HTTP status `code >= 400`, you can also
431// use Client.SetResultStateCheckFunc to customize the result state check logic.
432func (r *Request) SetErrorResult(err any) *Request {
433 if err == nil {
434 return r
435 }
436 r.Error = util.GetPointer(err)
437 return r
438}
439
440// SetBearerAuthToken set bearer auth token for the request.
441func (r *Request) SetBearerAuthToken(token string) *Request {

Callers 4

SetErrorMethod · 0.95
SetErrorFunction · 0.80
SetErrorResultFunction · 0.80
testErrorFunction · 0.80

Calls 1

GetPointerFunction · 0.92

Tested by 1

testErrorFunction · 0.64