From bbf10365c57d3f4b766067960b2ccfbb041dffd7 Mon Sep 17 00:00:00 2001 From: barreiro Date: Thu, 24 Oct 2024 02:17:33 +0100 Subject: [PATCH] Specify the 202 Accepted response in RunService API --- docs/site/content/en/openapi/openapi.yaml | 4 ++++ .../io/hyperfoil/tools/horreum/api/services/RunService.java | 1 + horreum-web/src/domain/runs/RunImportModal.tsx | 1 + 3 files changed, 6 insertions(+) diff --git a/docs/site/content/en/openapi/openapi.yaml b/docs/site/content/en/openapi/openapi.yaml index a5983eef1..64ef94cc9 100644 --- a/docs/site/content/en/openapi/openapi.yaml +++ b/docs/site/content/en/openapi/openapi.yaml @@ -662,6 +662,10 @@ paths: format: int32 type: integer example: 101 + "202": + description: The run data will be processed asynchronously + content: + text/plain: {} "400": description: Some fields are missing or invalid content: diff --git a/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/RunService.java b/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/RunService.java index 1ca880d41..7038353cf 100644 --- a/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/RunService.java +++ b/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/services/RunService.java @@ -221,6 +221,7 @@ Response add(@QueryParam("test") String testNameOrId, "]")) @APIResponses(value = { @APIResponse(responseCode = "200", description = "id of the newly generated run", content = @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = SchemaType.INTEGER, implementation = Integer.class), example = "101")), + @APIResponse(responseCode = "202", description = "The run data will be processed asynchronously", content = @Content(mediaType = MediaType.TEXT_PLAIN)), @APIResponse(responseCode = "400", description = "Some fields are missing or invalid", content = @Content(mediaType = MediaType.APPLICATION_JSON)) }) @Operation(description = "Upload a new Run") diff --git a/horreum-web/src/domain/runs/RunImportModal.tsx b/horreum-web/src/domain/runs/RunImportModal.tsx index e88e307e3..fd8bfbb2a 100644 --- a/horreum-web/src/domain/runs/RunImportModal.tsx +++ b/horreum-web/src/domain/runs/RunImportModal.tsx @@ -62,6 +62,7 @@ export const RunImportModal = (props: RunImportModalProps) => { ) , alerting, "UPLOAD_ERROR", "Failed to upload run data") .then(noop) + .catch(noop) .then(() => props.onClose()) }