-
Notifications
You must be signed in to change notification settings - Fork 57
Add HTTP method shortcuts and output expression support in DSL #1458
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,16 +33,26 @@ public interface BaseCallHttpSpec<SELF extends BaseCallHttpSpec<SELF>> { | |
| */ | ||
| List<Consumer<CallHttpTaskFluent<?>>> steps(); | ||
|
|
||
| default SELF GET() { | ||
| default SELF get() { | ||
| steps().add(c -> c.method("GET")); | ||
| return self(); | ||
| } | ||
|
|
||
| default SELF POST() { | ||
| @Deprecated | ||
| default SELF GET() { | ||
| return get(); | ||
| } | ||
|
|
||
| default SELF post() { | ||
| steps().add(c -> c.method("POST")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF POST() { | ||
| return post(); | ||
| } | ||
|
|
||
| default SELF acceptJSON() { | ||
| return header("Accept", "application/json"); | ||
| } | ||
|
|
@@ -122,6 +132,84 @@ default SELF query(String name, String value) { | |
| return self(); | ||
| } | ||
|
|
||
| default SELF put() { | ||
| steps().add(c -> c.method("PUT")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF PUT() { | ||
| return put(); | ||
| } | ||
|
|
||
| default SELF delete() { | ||
| steps().add(c -> c.method("DELETE")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF DELETE() { | ||
| return delete(); | ||
| } | ||
|
|
||
| default SELF patch() { | ||
| steps().add(c -> c.method("PATCH")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF PATCH() { | ||
| return patch(); | ||
| } | ||
|
|
||
| default SELF head() { | ||
| steps().add(c -> c.method("HEAD")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF HEAD() { | ||
| return head(); | ||
| } | ||
|
|
||
| default SELF options() { | ||
| steps().add(c -> c.method("OPTIONS")); | ||
| return self(); | ||
| } | ||
|
|
||
| @Deprecated | ||
| default SELF OPTIONS() { | ||
| return options(); | ||
| } | ||
|
|
||
| default SELF acceptXML() { | ||
| return header("Accept", "application/xml"); | ||
| } | ||
|
|
||
| default SELF acceptForm() { | ||
| return header("Accept", "application/x-www-form-urlencoded"); | ||
| } | ||
|
|
||
| default SELF acceptText() { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you put an acceptJson?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, really I did not see it. |
||
| return header("Accept", "text/plain"); | ||
| } | ||
|
|
||
| default SELF contentTypeJSON() { | ||
| return header("Content-Type", "application/json"); | ||
| } | ||
|
|
||
| default SELF contentTypeXML() { | ||
| return header("Content-Type", "application/xml"); | ||
| } | ||
|
|
||
| default SELF contentTypeForm() { | ||
| return header("Content-Type", "application/x-www-form-urlencoded"); | ||
| } | ||
|
|
||
| default SELF contentTypeText() { | ||
| return header("Content-Type", "text/plain"); | ||
| } | ||
|
|
||
| default SELF redirect(boolean redirect) { | ||
| steps().add(c -> c.redirect(redirect)); | ||
| return self(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.