I write a json data structure, and store it in the url as a resource
type FileString struct {
Data string
}
rest.Resource("json_data", &FileString{Data : some_string})
but when I load it in the java-script, as a uri
开发者_开发知识库 loader.load( { model: '/json_data/', callback: function ( geometry ) {
...
}
I get in the js console
'Resource interpreted as Script but transferred with MIME type text/html.'
Where do I set the content type when doing rest.Resource(...)
???
Please Help.
You can't. rest.go doesn't expose that functionality. You could file an issue with the developer.
Goweb's API stuff provides much more control over the underlying HTTP allowing you to specify content type in the usual way.
精彩评论