Skip to content

Commit

Permalink
remove unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MinjiK committed Dec 5, 2023
1 parent 316873a commit 0e6b43b
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/amadeus/namespaces/shopping/flight_offers/pricing.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,16 @@ class Pricing {
* ```
*/
post(params = {}, additionalParams = {}) {
// Check if params is an array
if (Array.isArray(params)) {
// If it is, wrap it in the required structure
params = {
'data': {
'type': 'flight-offers-pricing',
'flightOffers': params
}
};
}
// Convert additionalParams object to query string
const queryString = Object.keys(additionalParams).map(key => key + '=' + additionalParams[key]).join('&');
return this.client.post('/v1/shopping/flight-offers/pricing?' + queryString, params);

// Check if queryString is empty before appending it to the URL
let url = '/v1/shopping/flight-offers/pricing';
if (queryString !== '') {
url += '?' + queryString;
}

return this.client.post(url, params);
}
}

Expand Down

0 comments on commit 0e6b43b

Please sign in to comment.