Skip to content

Commit

Permalink
Merge pull request #8639 from Expensify/marcaaron-betterLoggingForAut…
Browse files Browse the repository at this point in the history
…henticateFailures

[No QA] Stop sending `undefined` request params to the API
  • Loading branch information
marcaaron authored Apr 18, 2022
2 parents 88a03ff + d3bc627 commit 8908393
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libs/HttpUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ function processHTTPRequest(url, method = 'get', body = null, canCancel = true)
*/
function xhr(command, data, type = CONST.NETWORK.METHOD.POST, shouldUseSecure = false) {
const formData = new FormData();
_.each(data, (val, key) => formData.append(key, val));
_.each(data, (val, key) => {
// Do not send undefined request parameters to our API. They will be processed as strings of 'undefined'.
if (_.isUndefined(val)) {
return;
}

formData.append(key, val);
});
let apiRoot = shouldUseSecure ? CONFIG.EXPENSIFY.SECURE_EXPENSIFY_URL : CONFIG.EXPENSIFY.URL_API_ROOT;

if (shouldUseSecure && shouldUseSecureStaging) {
Expand Down

0 comments on commit 8908393

Please sign in to comment.