Skip to content

Is it safe to use RequestTemplate#MethodMeta? #2998

@Dainerx

Description

@Dainerx

Hello question (could not label the issue),

My goal is to get the url template without the host and port.

Given: https://{{host}}:{{port}}/v1/api/resource/{id}}
Wanted: /v1/api/resource/{id}

Today, this can be achieved by calling methodMetadata. However, it is annotated with Experimental

@Experimental
public RequestTemplate methodMetadata(MethodMetadata methodMetadata) {
    this.methodMetadata = methodMetadata;
    return this;
}

I am using it, in production code, as follow:

templatedRouted = request.requestTemplate().methodMetadata().template().path();

--

First things first, I would have preferred to use requestTemplate.uriTemplate() but uriTemplate field is not exposed as of today. Moreover requestTemplate.url() appends the path (https://github.com/OpenFeign/feign/blob/master/core/src/main/java/feign/RequestTemplate.java#L546).

Is it safe to use methodMetadata()? Have you gathered enough data to make a decision? Finally, should I check against nil?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions