Skip to content

error! method returns wrong content type "text/html" for 404 status code #1515

Closed
@khelll

Description

@khelll

When I do:

error!({message: 'no data'}, 404) or even simple one error!({}, 404)

I always get text/html for content-type with the response:

"<!DOCTYPE html>\n<html>\n<head>\n <style type=\"text/css\">\n body { text-align:center;font-family:helvetica,arial;font-size:22px;\n color:#888;margin:20px}\n #c {margin:0 auto;width:500px;text-align:left}\n </style>\n</head>\n<body>\n <h2>Sinatra doesn&rsquo;t know this ditty.</h2>\n <img src='http://localhost:7777/__sinatra__/404.png'>\n <div id=\"c\">\n Try this:\n <pre>get '/api/customers/111/info' do\n \"Hello World\"\nend\n</pre>\n </div>\n</body>\n</html>\n"

However, if I change to any other status code like error!({}, 500), it returns the expected JSON response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions