| 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. |