MCPcopy Create free account
hub / github.com/amadeus4dev/amadeus-java / prepareHeaders

Method prepareHeaders

src/main/java/com/amadeus/Request.java:133–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

131
132 // Prepares the headers to be sent in the request
133 private void prepareHeaders() {
134 this.headers = new HashMap<String, String>();
135 headers.put(Constants.USER_AGENT, buildUserAgent());
136 headers.put(Constants.ACCEPT, "application/json, application/vnd.amadeus+json");
137
138 if (bearerToken != null) {
139 headers.put(Constants.AUTHORIZATION, bearerToken);
140 headers.put(Constants.CONTENT_TYPE, "application/vnd.amadeus+json");
141
142 // Checks if the request needs an X-Http-Method-Override header
143 if (Constants.APIS_WITH_EXTRA_HEADER.contains(path) && verb == HttpVerbs.POST) {
144 headers.put(Constants.X_HTTP_METHOD_OVERRIDE, HttpVerbs.GET.name());
145 }
146
147 }
148
149 }
150
151 // Determines the User-Agent header, based on the client version, language version, and custom
152 // app information.

Callers 1

RequestMethod · 0.95

Calls 1

buildUserAgentMethod · 0.95

Tested by

no test coverage detected