Skip to content

Commit 79e1735

Browse files
committed
updated in request, still pending updates on test senario
1 parent ecae28d commit 79e1735

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

amadeus/client/request.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,19 @@ def __build_http_request(self):
9595
# Adds the authentication header since the bearer token has been set
9696
self.headers['Authorization'] = self.bearer_token
9797

98+
# List of paths that require HTTP override in header
9899
list_httpoverride = [
99100
'/v2/shopping/flight-offers',
100101
'/v1/shopping/seatmaps',
101102
'/v1/shopping/availability/flight-availabilities',
102103
'/v2/shopping/flight-offers/prediction',
103-
'/v1/shopping/flight-offers/pricing',
104+
'/v1/shopping/flight-offers/pricing?',
104105
'/v1/shopping/flight-offers/upselling'
105106
]
106107

107108
if self.verb == 'POST':
108109
if self.path in list_httpoverride:
109110
self.headers['X-HTTP-Method-Override'] = 'GET'
110-
return HTTPRequest(self.url, headers=self.headers, method='POST',
111-
data=self.params.encode())
112111
if type(self.params) is dict:
113112
return HTTPRequest(self.url, headers=self.headers, method='POST',
114113
data=json.dumps(self.params).encode())

specs/client/request_spec.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@
8686
expect(self.request.http_request.data).to(
8787
equal(b'{\"foo\": \"bar\"}'))
8888

89+
with it('should return X-HTTP-Method-Override as GET in HTTP header for some endpoints'):
90+
self.request = Request({
91+
'host': self.host,
92+
'verb': 'POST',
93+
'path': self.path,
94+
'params': self.params,
95+
'bearer_token': self.bearer_token,
96+
'client_version': self.client_version,
97+
'language_version': self.lang_version,
98+
'app_id': self.app_id,
99+
'app_version': self.app_version,
100+
'port': self.port,
101+
'ssl': self.ssl
102+
})
103+
104+
expect(self.request.http_request).to(be_a(HTTPRequest))
105+
expect(self.request.http_request.get_header('X-HTTP-Method-Override')).to(
106+
equal('GET')
107+
)
108+
89109
with it('should handle a custom scheme and port'):
90110
self.request = Request({
91111
'host': self.host,

0 commit comments

Comments
 (0)