@@ -104,12 +104,14 @@ public class EnvironmentController {
|
||||
this.acceptEmpty = acceptEmpty;
|
||||
}
|
||||
|
||||
@GetMapping(path = "/{name}/{profiles:[^\\.]*}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@GetMapping(path = "/{name}/{profiles:(?!.*\\b\\.(?:ya?ml|properties|json)\\b).*}",
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public Environment defaultLabel(@PathVariable String name, @PathVariable String profiles) {
|
||||
return getEnvironment(name, profiles, null, false);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/{name}/{profiles:[^\\.]*}", produces = EnvironmentMediaType.V2_JSON)
|
||||
@GetMapping(path = "/{name}/{profiles:(?!.*\\b\\.(?:ya?ml|properties|json)\\b).*}",
|
||||
produces = EnvironmentMediaType.V2_JSON)
|
||||
public Environment defaultLabelIncludeOrigin(@PathVariable String name, @PathVariable String profiles) {
|
||||
return getEnvironment(name, profiles, null, true);
|
||||
}
|
||||
|
||||
@@ -643,11 +643,11 @@ class EnvironmentControllerTests {
|
||||
|
||||
@Test
|
||||
public void handleEnvironmentException() throws Exception {
|
||||
when(EnvironmentControllerTests.this.repository.findOne(eq("exception"), eq("bad_syntax"), any(),
|
||||
when(EnvironmentControllerTests.this.repository.findOne(eq("exception"), eq("bad_syntax.ext"), any(),
|
||||
eq(false)))
|
||||
.thenThrow(new FailedToConstructEnvironmentException("Cannot construct",
|
||||
new RuntimeException("underlier")));
|
||||
MvcResult result = this.mvc.perform(MockMvcRequestBuilders.get("/exception/bad_syntax"))
|
||||
MvcResult result = this.mvc.perform(MockMvcRequestBuilders.get("/exception/bad_syntax.ext"))
|
||||
.andExpect(MockMvcResultMatchers.status().is(500)).andReturn();
|
||||
assertThat(result.getResponse().getErrorMessage()).isEqualTo("Cannot construct");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user