Skip to content

Commit aebb808

Browse files
fix: correctly adding contentType in java (#588)
<!-- We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below. Please format the PR title appropriately based on the type of change: <type>[!]: <description> Where <type> is one of: docs, chore, feat, fix, test, misc. Add a '!' after the type for breaking changes (e.g. feat!: new breaking feature). **All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.** Please enter each Issue number you are resolving in your PR after one of the following words [Fixes, Closes, Resolves]. This will auto-link these issues and close them when this PR is merged! e.g. Fixes #1 Closes #2 --> # Fixes # Earlier contentType was set in java only when formParam or bodyParam was present in the operation. However, the check should be about json-type body or else. Corrected the mustache file. ### Checklist - [x] I acknowledge that all my contributions will be made under the project's license - [ ] Run `make test-docker` - [ ] Verify affected language: - [ ] Generate [twilio-go](https://github.com/twilio/twilio-go) from our [OpenAPI specification](https://github.com/twilio/twilio-oai) using the [build_twilio_go.py](./examples/build_twilio_go.py) using `python examples/build_twilio_go.py path/to/twilio-oai/spec/yaml path/to/twilio-go` and inspect the diff - [ ] Run `make test` in `twilio-go` - [ ] Create a pull request in `twilio-go` - [ ] Provide a link below to the pull request - [ ] I have made a material change to the repo (functionality, testing, spelling, grammar) - [ ] I have read the [Contribution Guidelines](https://github.com/twilio/twilio-oai-generator/blob/main/CONTRIBUTING.md) and my PR follows them - [ ] I have titled the PR appropriately - [ ] I have updated my branch with the main branch - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation about the functionality in the appropriate .md file - [ ] I have added inline documentation to the code I modified If you have questions, please create a GitHub Issue in this repository.
1 parent 4fca828 commit aebb808

File tree

18 files changed

+49
-22
lines changed

18 files changed

+49
-22
lines changed

examples/java/src/main/java/com/twilio/rest/api/v2010/AccountDeleter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public boolean delete(final TwilioRestClient client) {
6868
Domains.API.toString(),
6969
path
7070
);
71+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7172
Response response = client.request(request);
7273

7374
if (response == null) {

examples/java/src/main/java/com/twilio/rest/api/v2010/AccountFetcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public Account fetch(final TwilioRestClient client) {
6969
Domains.API.toString(),
7070
path
7171
);
72+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7273
Response response = client.request(request);
7374

7475
if (response == null) {

examples/java/src/main/java/com/twilio/rest/api/v2010/AccountReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public Page<Account> firstPage(final TwilioRestClient client) {
9494
);
9595

9696
addQueryParams(request);
97+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
9798
return pageForRequest(client, request);
9899
}
99100

examples/java/src/main/java/com/twilio/rest/api/v2010/account/CallDeleter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public boolean delete(final TwilioRestClient client) {
7272
Domains.API.toString(),
7373
path
7474
);
75+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7576
Response response = client.request(request);
7677

7778
if (response == null) {

examples/java/src/main/java/com/twilio/rest/api/v2010/account/CallFetcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public Call fetch(final TwilioRestClient client) {
7373
Domains.API.toString(),
7474
path
7575
);
76+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7677
Response response = client.request(request);
7778

7879
if (response == null) {

examples/java/src/main/java/com/twilio/rest/flexapi/v1/CallUpdater.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public Call update(final TwilioRestClient client){
6767
Domains.FLEXAPI.toString(),
6868
path
6969
);
70+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7071
Response response = client.request(request);
7172
if (response == null) {
7273
throw new ApiConnectionException("Call update failed: Unable to connect to server");

examples/java/src/main/java/com/twilio/rest/flexapi/v1/credential/AwsDeleter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public boolean delete(final TwilioRestClient client) {
6565
Domains.FLEXAPI.toString(),
6666
path
6767
);
68+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
6869
Response response = client.request(request);
6970

7071
if (response == null) {

examples/java/src/main/java/com/twilio/rest/flexapi/v1/credential/AwsFetcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public Aws fetch(final TwilioRestClient client) {
6666
Domains.FLEXAPI.toString(),
6767
path
6868
);
69+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
6970
Response response = client.request(request);
7071

7172
if (response == null) {

examples/java/src/main/java/com/twilio/rest/flexapi/v1/credential/AwsReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public Page<Aws> firstPage(final TwilioRestClient client) {
7474
);
7575

7676
addQueryParams(request);
77+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7778
return pageForRequest(client, request);
7879
}
7980

examples/java/src/main/java/com/twilio/rest/flexapi/v1/credential/aws/HistoryFetcher.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public History fetch(final TwilioRestClient client) {
7272
path
7373
);
7474
addQueryParams(request);
75+
request.setContentType(EnumConstants.ContentType.FORM_URLENCODED);
7576
Response response = client.request(request);
7677

7778
if (response == null) {

0 commit comments

Comments
 (0)