Skip to content
This repository has been archived by the owner on Dec 9, 2020. It is now read-only.

Content-Type validation is too strict #9

Merged
merged 1 commit into from
Nov 20, 2012

Conversation

naasir
Copy link
Contributor

@naasir naasir commented Nov 20, 2012

  • Previous implementation required the form-encoded content-type to look exactly like: 'application/x-www-form-urlencoded'. However, certain popular libraries, such as jQuery default to adding the character encoding as a suffix: 'application/x-www-form-urlencoded; charset=utf8'. Furthermore, when an ajax request is made from certain browsers (Firefox, IE), the character encoding is automatically added as a suffix. This change makes the content-type check more forgiving for scenarios where additional character encoding information is supplied.

* Previous implementation required the form-encoded content-type to look exactly like: 'application/x-www-form-urlencoded'. However, certain popular libraries, such as jQuery default to adding the character encoding as a suffix: 'application/x-www-form-urlencoded; charset=utf8'. Furthermore, when an ajax request is made from certain browsers (Firefox, IE), the character encoding is automatically added as a suffix. This change makes the content-type check more forgiving for scenarios where additional character encoding information is supplied.
@@ -123,34 +123,6 @@ public void WhenPasswordIsInvalid_ThenThrowsException()
}

[Test]
public void WhenContentTypeIsInvalid_ThenThrowsException()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this test case, as I moved the content-type check out of the PasswordTokenRequestAuthorizer into the PasswordRequestValidator, as the other validators were already checking the content-type there.

@micahlmartin
Copy link
Owner

Very nice! This looks great. Thanks for taking care of it.

micahlmartin pushed a commit that referenced this pull request Nov 20, 2012
Content-Type validation is too strict
@micahlmartin micahlmartin merged commit ad17e0f into micahlmartin:master Nov 20, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants