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

@AnyVerb annotation makes web methods explicitly accept any HTTP verb #205

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

daniel-beck
Copy link
Member

@daniel-beck daniel-beck commented Jan 21, 2021

I want an explicit version of the implied default. Alternatively, people could use @GET @POST on the same method (other verbs we rarely care about).

Can be considered preparation for jenkinsci/jenkins-test-harness#133

WIP. Untested.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

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

Why would we do this? Seems to be just encouraging people to do the wrong thing.

@daniel-beck
Copy link
Member Author

Why would we do this? Seems to be just encouraging people to do the wrong thing.

In cases where endpoints integrate with code that sends GET requests (IIRC, all the doFills, or similar – something like that blocked my progress on jenkinsci/jenkins#4623), or for endpoints that distinguish between GET and POST inside the method. Tons of code like that in core, e.g. all the doConfigDotXml. Can that be done more nicely since the verb annotations were introduced? Sure. This still has value in a transition phase.

@jglick
Copy link
Member

jglick commented Feb 8, 2021

We should do jenkinsci/jenkins#4623 and then there should be few endpoints I can think of that actually accept both.

  • doConfigDotXml as you mentioned; rarely defined in plugin code (normally inherited from AbstractItem)
  • doBuild taking an optional token; only redefined in build-token-root-plugin

@jglick
Copy link
Member

jglick commented Feb 8, 2021

Oh and doCommitStatus or similar in some SCM plugins historically allowing anonymous GET requests to be used from post-commit hooks. (Requiring POST and add a CrumbExclusion is preferred going forward.)

@jglick jglick marked this pull request as draft April 7, 2021 15:43
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