Reputation: 45
The content type script does not exist in the actix web framework. But is there any other way to tell the browser that the sent file is a script? this would be the http response i used
Response::JS => {
HttpResponse::Ok()
.content_type(ContentType::/*what needs to be here???*/)
.insert_header(("X-Hdr", "sample"))
.body(x)
}
as cdhowie suggest
.content_type(mime::APPLICATION_JAVASCRIPT)
works thx
Upvotes: 0
Views: 771
Reputation: 168988
ContentType
is a tuple struct with a single Mime
value. You probably want mime::APPLICATION_JAVASCRIPT
, so you should be able to use .content_type(ContentType(mime::APPLICATION_JAVASCRIPT))
. It also looks like you can supply a Mime
value directly: .content_type(mime::APPLICATION_JAVASCRIPT)
.
Upvotes: 1