Search in sources :

Example 1 with Options

use of feign.Request.Options in project feign by OpenFeign.

the class SynchronousMethodHandler method invoke.

@Override
public Object invoke(Object[] argv) throws Throwable {
    RequestTemplate template = buildTemplateFromArgs.create(argv);
    Options options = findOptions(argv);
    Retryer retryer = this.retryer.clone();
    while (true) {
        try {
            return executeAndDecode(template, options);
        } catch (RetryableException e) {
            try {
                retryer.continueOrPropagate(e);
            } catch (RetryableException th) {
                Throwable cause = th.getCause();
                if (propagationPolicy == UNWRAP && cause != null) {
                    throw cause;
                } else {
                    throw th;
                }
            }
            if (logLevel != Logger.Level.NONE) {
                logger.logRetry(metadata.configKey(), logLevel);
            }
            continue;
        }
    }
}
Also used : Options(feign.Request.Options)

Example 2 with Options

use of feign.Request.Options in project feign by OpenFeign.

the class ReactiveFeignIntegrationTest method testReactorTargetFull.

@Test
public void testReactorTargetFull() throws Exception {
    this.webServer.enqueue(new MockResponse().setBody("1.0"));
    this.webServer.enqueue(new MockResponse().setBody("{ \"username\": \"test\" }"));
    TestReactorService service = ReactorFeign.builder().encoder(new JacksonEncoder()).decoder(new JacksonDecoder()).logger(new ConsoleLogger()).decode404().options(new Options()).logLevel(Level.FULL).target(TestReactorService.class, this.getServerUrl());
    assertThat(service).isNotNull();
    StepVerifier.create(service.version()).expectNext("1.0").expectComplete().verify();
    assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/version");
    /* test encoding and decoding */
    StepVerifier.create(service.user("test")).assertNext(user -> assertThat(user).hasFieldOrPropertyWithValue("username", "test")).expectComplete().verify();
    assertThat(webServer.takeRequest().getPath()).isEqualToIgnoringCase("/users/test");
}
Also used : MockResponse(okhttp3.mockwebserver.MockResponse) Options(feign.Request.Options) JacksonEncoder(feign.jackson.JacksonEncoder) JacksonDecoder(feign.jackson.JacksonDecoder) Test(org.junit.Test)

Aggregations

Options (feign.Request.Options)2 JacksonDecoder (feign.jackson.JacksonDecoder)1 JacksonEncoder (feign.jackson.JacksonEncoder)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 Test (org.junit.Test)1