MCPcopy Create free account
hub / github.com/goadesign/goa / ContentType

Function ContentType

dsl/http.go:1115–1124  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1113// })
1114// })
1115func 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.

Callers 4

result_dsls.goFile · 0.85
openapi_dsls.goFile · 0.85

Calls 2

CurrentFunction · 0.92
IncompatibleDSLFunction · 0.92

Tested by

no test coverage detected