1

I have an api as part of my rails app, when a call comes in the controller responds with;

render plain: "OK - Request accepted",status: :ok, content_type: "text/html"

the output in terminal is

OK - Request accepted%

enter image description here

what does the percentage sign mean and where does it come from? can I remove it? ( I'm accessing the url via curl and using iterm )

Community
  • 1
  • 1
raphael_turtle
  • 7,154
  • 10
  • 55
  • 89
  • 2
    What is your shell command prompt? – Bob Mazanec Nov 20 '14 at 13:01
  • I found something similar in the following link: http://stackoverflow.com/questions/5658510/curl-json-post-request-via-terminal-to-a-rails-app I am not sure if that can help understanding your problem. – Rubyrider Nov 20 '14 at 13:06

1 Answers1

3

It's your shell prompt.

Configure curl to add a newline to the output -- cf Automatically add newline at end of curl response body

Look example:

bash: PS1=foo
foo: curl -H -i  'http://localhost:3000/'
OK - Request acceptedfoo:

add with \n:

foo: curl -H -i  'http://localhost:3000/' -w '\n'
OK - Request accepted
foo:
Community
  • 1
  • 1
Bob Mazanec
  • 1,121
  • 10
  • 18