Skip to content

Commit

Permalink
Changed template create/update REST call from POST to PUT #3521
Browse files Browse the repository at this point in the history
  • Loading branch information
de-jcup committed Dec 5, 2024
1 parent 110ce3a commit de70eb3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void restdoc_admin_creates_or_updates_template() throws Exception {

/* execute + test @formatter:off */
this.mockMvc.perform(
post(apiEndpoint, TEST_TEMPLATE_ID1).
put(apiEndpoint, TEST_TEMPLATE_ID1).
contentType(MediaType.APPLICATION_JSON_VALUE).
content(content).
header(AuthenticationHelper.HEADER_NAME, AuthenticationHelper.getHeaderValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ public SecHubEncryptionStatus fetchEncryptionStatus() {

public AsUser createOrUpdateTemplate(String templateId, TemplateDefinition definition) {
String url = getUrlBuilder().buildAdminCreatesOrUpdatesTemplate(templateId);
getRestHelper().postJson(url, definition.toFormattedJSON());
getRestHelper().putJSON(url, definition.toFormattedJSON());
return this;
}

Expand Down
2 changes: 1 addition & 1 deletion sechub-openapi-java/src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3918,7 +3918,7 @@ paths:
- Other

/api/admin/template/{templateId}:
post:
put:
summary: Admin creates or updates a template
description: An administrator wants to create a new template or to update a template definition
operationId: adminCreateOrUpdateTemplate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TemplateRestController {
LogSanitizer logSanitizer;

@UseCaseAdminCreatesOrUpdatesTemplate(@Step(number = 1, next = 2, name = "REST API call to create or update template", needsRestDoc = true))
@RequestMapping(path = "/template/{templateId}", method = RequestMethod.POST)
@RequestMapping(path = "/template/{templateId}", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.OK)
public void createOrUpdate(@RequestBody TemplateDefinition templateDefinition, @PathVariable("templateId") String templateId) {

Expand Down

0 comments on commit de70eb3

Please sign in to comment.