Skip to content

Fix for Optional request bodies - #1530

Merged
ssalinas merged 1 commit into
masterfrom
npe_fix
May 10, 2017
Merged

ssalinas merged 1 commit into
masterfrom
npe_fix

Conversation

@ssalinas

@ssalinas ssalinas commented May 8, 2017

Copy link
Copy Markdown
Contributor

Seems that after the jersey/dropwizard upgrade the Optional bodies are not coming through correctly and are null instead of absent() when the body is not present. Updated the impacted endpoints (anything with an Optional body) to take the object (nullable) and construct the Optional afterwards. Actually made the tests look a bit nicer not wrapping everything in Optional.of() too.

I can test this out and try to get a 15.1 out if it looks good.
/cc @darcatron @stevenschlansker @dstryker @pennello @sannessa
/fixes #1525

@pennello

pennello commented May 8, 2017

Copy link
Copy Markdown

Thanks @ssalinas. The test cleanup is nice, but it's a disappointing the injection is now a little more cumbersome. I wonder if this is actually intended given the jersey/dropwizard upgrade, or if it's an upstream bug.

@ssalinas

ssalinas commented May 8, 2017 •

Copy link
Copy Markdown
Contributor Author

@pennello , as far as I could tell it was never really documented that an Optional request body was something that was expected to work (at least I couldn't find it on the dropwizard or jersey docs easily). There is a lot around optional *Params and the validation annotations, but not much around actual request bodies.

@stevenschlansker

Copy link
Copy Markdown
Contributor

Yeah, I'll second the surprise that the container doesn't do this for you (maybe there's a fix that should go upstream to Jersey?) but obviously I'm in favor of fixing the issue despite uglifying the code :)

@ssalinas ssalinas added the hs_qa label May 8, 2017
@ssalinas ssalinas modified the milestone: 0.15.1 May 8, 2017
@ssalinas
ssalinas merged commit 78fd166 into master May 10, 2017
@ssalinas
ssalinas deleted the npe_fix branch May 10, 2017 12:55
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.

singularity 0.15.0 NPE on DELETE /tasks/task/<id> with no body

3 participants