[ruby] return body with headers on / weblog endpoint#6307
Conversation
JJ-Change-Id: wkrxvy
…` on `/` Update all Ruby weblog variants to return `"Hello world!\n"` with explicit `Content-Type: text/plain` and `Content-Length: 13` headers from the `/` endpoint, matching the updated weblog specification. Variants fixed: `sinatra14`, `sinatra22`, `sinatra32`, `sinatra41`, `rack`, `rails42`, `rails52`, `rails61`, `rails72`, `rails80`, `graphql23`. JJ-Change-Id: lskotw
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 72ae4b9ec0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| get '/' do | ||
| 'Hello, world!' | ||
| content_type 'text/plain' | ||
| headers 'Content-Length' => '13' | ||
| "Hello world!\n" |
There was a problem hiding this comment.
Update Sinatra POST / to match root response contract
This change updates only get '/' in the Sinatra weblogs, while post '/' in the same apps still returns 'Hello, world!' without the new text/plain and Content-Length: 13 headers. Because the / endpoint contract applies to both GET and POST, POST requests for sinatra14/22/32/41 remain out of spec and can still fail endpoint validation for Ruby weblog variants.
Useful? React with 👍 / 👎.
/ endpoint/ weblog endpoint
|
|
|
@codex verify that changes for content-type and content-length are needed in case of Rails, Sinatra and Rack here. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 584deffb5f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| get '/' do | ||
| 'Hello, world!' | ||
| content_type 'text/plain' | ||
| headers 'Content-Length' => '13' | ||
| "Hello world!\n" |
There was a problem hiding this comment.
Align Sinatra POST / with the updated root response
This change updates only get '/', but Sinatra defines a separate post '/' handler that still returns 'Hello, world!' and does not set the new headers. As a result, POST requests to / in Sinatra variants still violate the updated root contract (Hello world!\n plus Content-Type/Content-Length), so checks that exercise POST / will fail even though GET / now passes.
Useful? React with 👍 / 👎.
Strech
left a comment
There was a problem hiding this comment.
I will block it because Rails and Sinatra auto-add headers, we will work on it
Summary
Update all 11 Ruby weblog variants to return
"Hello world!\n"with explicitContent-Type: text/plainandContent-Length: 13headers from the/endpoint, matching the updated weblog specification.Variants fixed
sinatra14,sinatra22,sinatra32,sinatra41,rack,rails42,rails52,rails61,rails72,rails80,graphql23Previously had
"Hello, world!"(comma, no\n),rackhad"Hello, wat is love?".