Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for URI's path prefix modification #952

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

big-cir
Copy link

@big-cir big-cir commented Dec 27, 2024

Overview

  1. Added pathPrefix field and setter method to UriModifyingOperationPreprocessor
  2. Added corresponding support in UriModifyingContentModifier

Related Issues

#945

Test

@Test
public void requestContentUriPathIsPreservedAndAddPathPrefix() {
    this.preprocessor
		    .removePort()
		    .pathPrefix("/addPathPrefix");
    OperationRequest processed = this.preprocessor
	    .preprocess(createRequestWithContent("The uri 'http://localhost:12345/foo/bar' should be used"));
    assertThat(new String(processed.getContent())).isEqualTo("The uri 'http://localhost/addPathPrefix/foo/bar' should be used");
}

@Test
public void responseContentUriPathIsPreservedAndAddPathPrefix() {
    this.preprocessor
		    .removePort()
		    .pathPrefix("addPathPrefix");
    OperationResponse processed = this.preprocessor
	    .preprocess(createResponseWithContent("The uri 'http://localhost:12345/foo/bar' should be used"));
    assertThat(new String(processed.getContent())).isEqualTo("The uri 'http://localhost/addPathPrefix/foo/bar' should be used");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants