新手问题 请问 Grape 怎么能返回不带引号的字符串

birbird · 2015年09月25日 · 最后由 jiemoon 回复于 2015年10月25日 · 1718 次阅读

比如这样的接口,返回的是 "hello",我不要引号,只要 hello,怎么能做到呢? 高人请指点,谢啦先!

params do
  ...
end
get do
  "hello"
end

The answer is

class API < Grape::API
  get '/' do
    content_type 'text/plain'
    body 'Hello World'
    # return value ignored
  end
end

#1 楼 @birbird 好像还是有 引号 😞

#1 楼 @birbird 好像还是有 引号 😞

#1 楼 @jiemoon 可以,是其它的问题,感谢 👍

需要 登录 后方可回复, 如果你还没有账号请 注册新账号