Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overwriting headers in Advanced causes 500 #49

Open
zdrummond opened this issue Aug 15, 2019 · 0 comments
Open

Overwriting headers in Advanced causes 500 #49

zdrummond opened this issue Aug 15, 2019 · 0 comments

Comments

@zdrummond
Copy link

DuckRails 2.1.9
Running on Docker

I was just playing around, and wanted to dynamically change responses headers. When I tried returning a JSON object with a headers key I get a 500: "We're sorry, but something went wrong".

To validate that I was writing the JS correctly, I just grabbed your example code for the response body, added the headers key and returned it.

Here is the code

var date = new Date();
date.setDate(date.getDate() -  Math.floor(Math.random() * 30 + 1) );

var obj = {
 "headers":{
       "current_page": Math.floor((Math.random() * 456) + 1),
        "started_reading": date.toDateString()
   }
}

return JSON.stringify(obj);

Expected: Headers would now have a current_page and started_reading key in my curl.

Actual: Return code 500, HTML with

<div class="dialog">
    <div>
      <h1>We're sorry, but something went wrong.</h1>
    </div>
    <p>If you are the application owner check the logs for more information.</p>
  </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant