Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PP-12853 Add the charset in Content-Type header for Apple Pay #3886

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,20 @@ module.exports = async (req, res) => {
}

const alternativeOptions = {
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json; charset=utf-8' },
httpsAgent: proxyAgent
}

try {
const response = await axios.post(url, data, alternativeOptions)

logger.info('Apple Pay session successfully generated via axios')
logger.info('Apple Pay session successfully generated via axios and https proxy agent')
res.status(200).send(response.data)
} catch (error) {
logger.info('Error generating Apple Pay session', {
...getLoggingFields(req),
error: error.message
error: error.message,
status: error.response ? error.response.status : 'No status'
})
logger.info('Apple Pay session via axios and https proxy agent failed', 'Apple Pay Error')
res.status(500).send('Apple Pay Error')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('Validate with Apple the merchant is legitimate', () => {
initiativeContext: merchantDomain
}),
sinon.match({
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json; charset=utf-8' },
httpsAgent: sinon.match.instanceOf(HttpsProxyAgent)
})
)
Expand Down Expand Up @@ -145,7 +145,7 @@ describe('Validate with Apple the merchant is legitimate', () => {
initiativeContext: merchantDomain
}),
sinon.match({
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json; charset=utf-8' },
httpsAgent: sinon.match.instanceOf(HttpsProxyAgent)
})
)
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('Validate with Apple the merchant is legitimate', () => {
initiativeContext: merchantDomain
}),
sinon.match({
headers: { 'Content-Type': 'application/json' },
headers: { 'Content-Type': 'application/json; charset=utf-8' },
httpsAgent: sinon.match.instanceOf(HttpsProxyAgent)
})
)
Expand Down
Loading