开发者

specifying type of content in rest.Resource (rest.go lib & Golang)

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜