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

birbird · September 25, 2015 · Last by jiemoon replied at October 25, 2015 · 1719 hits

比如这样的接口,返回的是 "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 可以,是其它的问题,感谢 👍

You need to Sign in before reply, if you don't have an account, please Sign up first.