Home > Software design >  How to return text with line break with Grape API?
How to return text with line break with Grape API?

Time:02-10

I am trying to create an endpoint where the response body is just a string with line breaks, but the response keeps showing the \n character.

My endpoint code:

get '' do
  header('Content-Type', 'text/plain')
  body("Hello\nWorld")
end

And this is the response I see in Postman:

enter image description here

What am I missing here?

Thank you

CodePudding user response:

\n is a new line character for UNIX systems, and in enter image description here

  • Related