Skip to content

Document that Request.ifModifiedSince throws FormatException - #129

Merged
jonasfj merged 1 commit into
dart-lang:masterfrom
jonasfj:document-format-exception
Mar 2, 2020
Merged

jonasfj merged 1 commit into
dart-lang:masterfrom
jonasfj:document-format-exception

Conversation

@jonasfj

@jonasfj jonasfj commented Feb 25, 2020

Copy link
Copy Markdown
Member

It's a bit surprising that Request.ifModifiedSince throws FormatException if the incoming request is invalid.

We could also return null. But this has the downside of building a server that accepts invalid requests. The problem with accepting invalid requests is that you're going to break your users if you fix such a bug later.

Ideally, we should throw an exception that is caught and converted to 400 at some higher level.
But this would be a new way of structuring apps in shelf, so we should probably consider this in detail before we jump on the idea.

@kevmoo

kevmoo commented Feb 25, 2020

Copy link
Copy Markdown
Member

Cleary an oversight. To throw "at some higher level" you'd almost want to parse these, if found, during the request creation. Honestly, you could do that now – it could be a feature of the io adapter to validate incoming requests for such things...

@jonasfj

jonasfj commented Mar 2, 2020

Copy link
Copy Markdown
Member Author

Honestly, you could do that now – it could be a feature of the io adapter to validate incoming requests for such things...

That might be nice to do.

@jonasfj
jonasfj merged commit fa3b793 into dart-lang:master Mar 2, 2020
@jonasfj
jonasfj deleted the document-format-exception branch March 2, 2020 13:04
jonasfj pushed a commit to jonasfj/shelf that referenced this pull request May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants