MCPcopy Create free account
hub / github.com/kataras/iris / ProblemOptions

Struct ProblemOptions

context/problem.go:256–287  ·  view source on GitHub ↗

ProblemOptions the optional settings when server replies with a Problem. See `Context.Problem` method and `Problem` type for more details.

Source from the content-addressed store, hash-verified

254// ProblemOptions the optional settings when server replies with a Problem.
255// See `Context.Problem` method and `Problem` type for more details.
256type ProblemOptions struct {
257 // JSON are the optional JSON renderer options.
258 JSON JSON
259
260 // RenderXML set to true if want to render as XML doc.
261 // See `XML` option field too.
262 RenderXML bool
263 // XML are the optional XML renderer options.
264 // Affect only when `RenderXML` field is set to true.
265 XML XML
266
267 // RetryAfter sets the Retry-After response header.
268 // https://tools.ietf.org/html/rfc7231#section-7.1.3
269 // The value can be one of those:
270 // time.Time
271 // time.Duration for seconds
272 // int64, int, float64 for seconds
273 // string for duration string or for datetime string.
274 //
275 // Examples:
276 // time.Now().Add(5 * time.Minute),
277 // 300 * time.Second,
278 // "5m",
279 // 300
280 RetryAfter interface{}
281 // A function that, if specified, can dynamically set
282 // retry-after based on the request. Useful for ProblemOptions reusability.
283 // Should return time.Time, time.Duration, int64, int, float64 or string.
284 //
285 // Overrides the RetryAfter field.
286 RetryAfterFunc func(*Context) interface{}
287}
288
289func parseDurationToSeconds(dur time.Duration) int64 {
290 return int64(math.Round(dur.Seconds()))

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected