Skip to content

Commit

Permalink
Merge pull request #136 from companieshouse/feature/dsnd-2832
Browse files Browse the repository at this point in the history
get list should allow trailing /
  • Loading branch information
JAndrewCH authored Jul 26, 2024
2 parents aa381ae + 731105e commit d6e69d2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import uk.gov.companieshouse.api.filter.CustomCorsFilter;
Expand All @@ -26,6 +27,11 @@ public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(userAuthenticationInterceptor());
}

@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
configurer.setUseTrailingSlashMatch(true);
}

@Bean
public InternalUserInterceptor internalUserInterceptor() {
return new InternalUserInterceptor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,25 @@ void callPscListGetRequestWithParams() throws Exception {
.andExpect(status().isOk());
}

@Test
void callPscListGetRequestWithTrailingSlash() throws Exception {
when(companyPscService.retrievePscListSummaryFromDb(MOCK_COMPANY_NUMBER, 2, false, 5))
.thenReturn(new PscList());

mockMvc.perform(MockMvcRequestBuilders
.get(GET_List_Summary_URL+"/")
.contentType(MediaType.APPLICATION_JSON)
.header("ERIC-Identity", ERIC_IDENTITY)
.header("ERIC-Identity-Type", ERIC_IDENTITY_TYPE)
.contentType(APPLICATION_JSON)
.header("x-request-id", X_REQUEST_ID)
.header("ERIC-Authorised-Key-Roles", ERIC_PRIVILEGES)
.header("ERIC-Authorised-Key-Privileges", ERIC_AUTH)
.header("items_per_page", 5)
.header("start_index", 2))
.andExpect(status().isOk());
}

@Test
void callPscListGetRequestWithRegisterView() throws Exception {
when(companyPscService.retrievePscListSummaryFromDb(MOCK_COMPANY_NUMBER, 2, true, 5))
Expand Down

0 comments on commit d6e69d2

Please sign in to comment.