ReplyBodyCodec initializes and returns the reply message body codec id.
()
| 544 | |
| 545 | // ReplyBodyCodec initializes and returns the reply message body codec id. |
| 546 | func (c *handlerCtx) ReplyBodyCodec() byte { |
| 547 | id := c.output.BodyCodec() |
| 548 | if id != codec.NilCodecID { |
| 549 | return id |
| 550 | } |
| 551 | id, ok := GetAcceptBodyCodec(c.input.Meta()) |
| 552 | if ok { |
| 553 | if _, err := codec.Get(id); err == nil { |
| 554 | c.output.SetBodyCodec(id) |
| 555 | return id |
| 556 | } |
| 557 | } |
| 558 | id = c.input.BodyCodec() |
| 559 | c.output.SetBodyCodec(id) |
| 560 | return id |
| 561 | } |
| 562 | |
| 563 | func (c *handlerCtx) setReplyBodyCodec(hasError bool) { |
| 564 | if hasError { |
no test coverage detected