11package com .amadeus ;
22
3+ import com .amadeus .Constants ;
34import com .amadeus .client .AccessToken ;
45import com .amadeus .exceptions .NetworkException ;
56import com .amadeus .exceptions .ResponseException ;
@@ -35,7 +36,7 @@ protected HTTPClient(Configuration configuration) {
3536 * @see Amadeus#get(String, Params)
3637 */
3738 public Response get (String path ) throws ResponseException {
38- return request (" GET" , path , null );
39+ return request (Constants . GET , path , null );
3940 }
4041
4142 /**
@@ -62,7 +63,7 @@ public Response get(String path) throws ResponseException {
6263 * @return a Response object containing the status code, body, and parsed data.
6364 */
6465 public Response get (String path , Params params ) throws ResponseException {
65- return request (" GET" , path , params );
66+ return request (Constants . GET , path , params );
6667 }
6768
6869 /**
@@ -72,7 +73,7 @@ public Response get(String path, Params params) throws ResponseException {
7273 * @see Amadeus#post(String, Params)
7374 */
7475 public Response post (String path ) throws ResponseException {
75- return request (" POST" , path , null );
76+ return request (Constants . POST , path , null );
7677 }
7778
7879 /**
@@ -99,7 +100,7 @@ public Response post(String path) throws ResponseException {
99100 * @return a Response object containing the status code, body, and parsed data.
100101 */
101102 public Response post (String path , Params params ) throws ResponseException {
102- return request (" POST" , path , params );
103+ return request (Constants . POST , path , params );
103104 }
104105
105106 /**
@@ -123,7 +124,7 @@ public Response unauthenticatedRequest(String verb, String path, Params params,
123124 * @throws ResponseException if the page could not be found
124125 */
125126 public Response previous (Response response ) throws ResponseException {
126- return page ("previous" , response );
127+ return page (Constants . PREVIOUS , response );
127128 }
128129
129130 /**
@@ -133,7 +134,7 @@ public Response previous(Response response) throws ResponseException {
133134 * @throws ResponseException if the page could not be found
134135 */
135136 public Resource [] previous (Resource resource ) throws ResponseException {
136- return page ("previous" , resource );
137+ return page (Constants . PREVIOUS , resource );
137138 }
138139
139140 /**
@@ -143,7 +144,7 @@ public Resource[] previous(Resource resource) throws ResponseException {
143144 * @throws ResponseException if the page could not be found
144145 */
145146 public Response next (Response response ) throws ResponseException {
146- return page ("next" , response );
147+ return page (Constants . NEXT , response );
147148 }
148149
149150 /**
@@ -153,7 +154,7 @@ public Response next(Response response) throws ResponseException {
153154 * @throws ResponseException if the page could not be found
154155 */
155156 public Resource [] next (Resource resource ) throws ResponseException {
156- return page ("next" , resource );
157+ return page (Constants . NEXT , resource );
157158 }
158159
159160 /**
@@ -163,7 +164,7 @@ public Resource[] next(Resource resource) throws ResponseException {
163164 * @throws ResponseException if the page could not be found
164165 */
165166 public Response first (Response response ) throws ResponseException {
166- return page ("first" , response );
167+ return page (Constants . FIRST , response );
167168 }
168169
169170 /**
@@ -173,7 +174,7 @@ public Response first(Response response) throws ResponseException {
173174 * @throws ResponseException if the page could not be found
174175 */
175176 public Resource [] first (Resource resource ) throws ResponseException {
176- return page ("first" , resource );
177+ return page (Constants . FIRST , resource );
177178 }
178179
179180 /**
@@ -183,7 +184,7 @@ public Resource[] first(Resource resource) throws ResponseException {
183184 * @throws ResponseException if the page could not be found
184185 */
185186 public Response last (Response response ) throws ResponseException {
186- return page ("last" , response );
187+ return page (Constants . LAST , response );
187188 }
188189
189190 /**
@@ -193,7 +194,7 @@ public Response last(Response response) throws ResponseException {
193194 * @throws ResponseException if the page could not be found
194195 */
195196 public Resource [] last (Resource resource ) throws ResponseException {
196- return page ("last" , resource );
197+ return page (Constants . LAST , resource );
197198 }
198199
199200 // A generic method for making requests of any verb.
@@ -237,7 +238,7 @@ private Request fetch(Request request) throws NetworkException {
237238
238239 // Writes the parameters to the request.
239240 private void write (Request request ) throws IOException {
240- if (request .getVerb () == " POST" && request .getParams () != null ) {
241+ if (request .getVerb () == Constants . POST && request .getParams () != null ) {
241242 OutputStream os = request .getConnection ().getOutputStream ();
242243 BufferedWriter writer = new BufferedWriter (new OutputStreamWriter (os , "UTF-8" ));
243244 writer .write (request .getParams ().toQueryString ());
0 commit comments