Skip to content

SPR-14818 - Add exception MissingServletRequestHeaderException #1218

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

Closed
wants to merge 2 commits into from

Conversation

AustinSong
Copy link

Reason : I am implementing a Restful API and needed to add a custom header value to all responses. Some endpoint contained required request headers and wanted to customize the output for the specific situation of missing header values, by handling a more specific exception than ServletRequestBindingException.

General usage benefit: This is more consistent with the implementation of required request parameters. There exists a MissingServletRequestParameterException for the specific situation of missing required request parameters. A more specific exception is beneficial.

Issue: SPR-14818

I have agreed to the ICLA.

Add a new exception, MissingServletRequestHeaderException, in the event
of a missing required request header.  This exception is more consistent
with how missing reqest parameters are handled.

Issue: SPR-14818
@snicoll snicoll changed the title Add exception MissingServletRequestHeaderException SPR-14818 - Add exception MissingServletRequestHeaderException Oct 24, 2016
@mathieuales
Copy link

Great !
Which is the minimal release for this new feature ?

@snicoll
Copy link
Member

snicoll commented Mar 2, 2017

@mathieuales the PR is still open (and so is the Jira issue). In other words, it's not available yet.

@radarsh
Copy link

radarsh commented Jul 21, 2017

Why is this issue still unresolved?

@AustinSong
Copy link
Author

https://jira.spring.io/browse/SPR-14818

The JIRA ticket seems to be tied to a different pull request, is that intentional? Are we looking to go with a more generic message?

@luyaor
Copy link

luyaor commented Jul 14, 2018

Dear Austin,

We are working on identifying redundant development and duplicated pull requests. We have found there is a pull request: #1653 which might be a potentially duplicate to this one. We would really appreciate if you could help us to validate and give us feedback.

Thank you very much for your time!

Sincerely,
Luyao

@AustinSong
Copy link
Author

AustinSong commented Jul 16, 2018

Hey @FancyCoder0 ,

These pull requests do appear to be duplicates, with some caveats. The other #1653 appears to be more of a generic exception covering several different missing header values. While an improvement, it still leaves ambiguity. This pull request specifically, is only dealing with the case of missing headers. I believe it would be beneficial to include specific exceptions being more explicit for common cases. The fact that it's done for request parameters leads me to also believe this is the favorable approach.

Hope this helps!

Best,
Austin

@izeye
Copy link
Contributor

izeye commented Jul 23, 2018

The referenced Jira issue has been resolved, so this PR looks closable.

@snicoll
Copy link
Member

snicoll commented Jul 23, 2018

Indeed, good catch again @izeye

@snicoll snicoll closed this Jul 23, 2018
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.

7 participants