Switch startup actuator endpoint to using HTTP POST

Closes gh-23213
pull/23219/head
Brian Clozel 4 years ago
parent 29e8f1d980
commit 8dcb3312f2

@ -32,7 +32,7 @@ import org.springframework.restdocs.payload.ResponseFieldsSnippet;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath;
import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
@ -75,7 +75,7 @@ class StartupEndpointDocumentationTests extends MockMvcEndpointDocumentationTest
fieldWithPath("timeline.events.[].startupStep.tags[].value")
.description("The value of the StartupStep Tag."));
this.mockMvc.perform(get("/actuator/startup")).andExpect(status().isOk())
this.mockMvc.perform(post("/actuator/startup")).andExpect(status().isOk())
.andDo(document("startup", responseFields));
}

@ -18,7 +18,7 @@ package org.springframework.boot.actuate.startup;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
import org.springframework.boot.context.metrics.buffering.StartupTimeline;
@ -44,7 +44,7 @@ public class StartupEndpoint {
this.applicationStartup = applicationStartup;
}
@ReadOperation
@WriteOperation
public StartupResponse startup() {
StartupTimeline startupTimeline = this.applicationStartup.drainBufferedTimeline();
return new StartupResponse(startupTimeline);

Loading…
Cancel
Save