ContentType sets the value of the Content-Type response header. ContentType must appear in a Response expression. ContentType accepts one argument: the mime type as defined by RFC 6838. var _ = Method("add", func() { HTTP(func() { Response(StatusOK, func() {
(typ string)
| 1113 | // }) |
| 1114 | // }) |
| 1115 | func ContentType(typ string) { |
| 1116 | switch actual := eval.Current().(type) { |
| 1117 | case *expr.ResultTypeExpr: |
| 1118 | actual.ContentType = typ // deprecated |
| 1119 | case *expr.HTTPResponseExpr: |
| 1120 | actual.ContentType = typ |
| 1121 | default: |
| 1122 | eval.IncompatibleDSL() |
| 1123 | } |
| 1124 | } |
| 1125 | |
| 1126 | // headers returns the mapped attribute containing the headers for the given |
| 1127 | // expression if it's either the root, a service or an endpoint - nil otherwise. |
no test coverage detected