Giter VIP home page Giter VIP logo

Comments (5)

spencergibb avatar spencergibb commented on May 12, 2024 1

@ph0bos I hadn't added support for parameter annotations yet. So your @PathVariable was ignored and the String was passed as the body, and when there is a body it assumes POST. I've added support for @PathVariable, @RequestParam and @RequestHeader

from spring-cloud-netflix.

viktor-coreteka avatar viktor-coreteka commented on May 12, 2024 1

@spencergibb in witch version?
RequestHeader doesnt work for me
I'm using springCloudVersion = 'Edgware.SR5'

from spring-cloud-netflix.

rohitdec01 avatar rohitdec01 commented on May 12, 2024 1

@ph0bos I hadn't added support for parameter annotations yet. So your @PathVariable was ignored and the String was passed as the body, and when there is a body it assumes POST. I've added support for @PathVariable, @RequestParam and @RequestHeader

I am not able to pass body in Get request while using Feign. If I am doing so it is still converting get request to post.
Do we have any work around on this? I just want to separate my header and body while calling the get method.

from spring-cloud-netflix.

rohitdec01 avatar rohitdec01 commented on May 12, 2024

I am not able to pass body in Get request while using Feign. If I am doing so it is still converting get request to post.
Do we have any work around on this. I just want to separate my header and body while calling the get method.

from spring-cloud-netflix.

rohitdec01 avatar rohitdec01 commented on May 12, 2024

@spencergibb in witch version?
RequestHeader doesnt work for me
I'm using springCloudVersion = 'Edgware.SR5'

Try this ..............

@component
public class AdapterRequestInterceptor implements RequestInterceptor {

/* (non-Javadoc)
 * @see feign.RequestInterceptor#apply(feign.RequestTemplate)
 */
@Override
public void apply(RequestTemplate requestTemplate) {
	HttpHeaders headers = new HttpHeaders();
	headers.setAccept(Arrays.asList(new MediaType[] { MediaType.APPLICATION_JSON }));
	headers.setContentType(MediaType.APPLICATION_JSON);
	// Other header values -- from a dynamic function.
	

	addHeadersToRequest(headers, requestTemplate);
	System.out.println("Test");
}

/**
 * @param headerParams
 * @param requestBuilder
 */
private void addHeadersToRequest(HttpHeaders headerParams, RequestTemplate requestBuilder) {
	for (Map.Entry<String, List<String>> entry : headerParams.entrySet()) {
		String headerName = entry.getKey();
		for (String headerValue : entry.getValue()) {
			requestBuilder.header(headerName, headerValue);
		}
	}
}

}

from spring-cloud-netflix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.