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

Default to HTML handler, not the first #1053

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Default to HTML handler, not the first #1053

merged 1 commit into from
Apr 11, 2022

Conversation

ysangkok
Copy link
Member

@ysangkok ysangkok commented Apr 9, 2022

Before this commit, the first handler would be chosen as the default, in the absense of an Accept header from the client.

This means that Elinks gets the JSON version of the package page, because it
doesn't send an Accept header (NOTE: this is wrong, Elinks sends Accept: */*), this was reported by @Merivuokko in a comment.

After this commit, the package page is again defaulting to HTML:

% curl -s -D - "http://localhost:8080/package/2captcha" | grep -i Content-type
Content-Type: text/html; charset=utf-8

@gbaz
Copy link
Contributor

gbaz commented Apr 11, 2022

Great sleuthing, thanks!

I confess to being a bit confused why the prior fix was not sufficient?

@gbaz gbaz merged commit e88e25a into haskell:master Apr 11, 2022
@ysangkok ysangkok deleted the janus/default-to-html branch April 11, 2022 02:58
@ysangkok
Copy link
Member Author

ysangkok commented Apr 11, 2022

@gbaz To sum up what I tried to say on IRC: I believe that the previous defaulting was not correct, since it doesn't make sense to me to have both the def argument and the defaulting to text/html inside negotiateContent. So if I can get some acknowledgement that this indeed a mistake, I can try and make a new PR that undos the change from 996, now that this PR has introduced (what I believe) to be a more reliable defaulting. A defaulting which should also work with the previous version of negotiateContent. I can attempt to write a unit test to verify this.

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

Successfully merging this pull request may close these issues.

2 participants