We has a request which has chinese in "CJK-Compatibility-Ideographs", . when the request was a post of application/json. the "CJK-Compatibility-Ideographs" would be changed to "CJK-Unified-Ideographs".
We will sign the request body when send a request to server, and server will checked the sign and body was correcttly. The bug will cause a big problem, make the post repuest always failure.
Do there has any solution?
63786 -> 28010, 64000 -> 20999
demo :
function HomePage() {
const [result, setResult] = useState('Click the top button');
const req = (name) => {
setResult('...');
const params = { name };
business
.request({
url: REST_URL.examSubmit,
params,
headers: {
appKey: '1274560575',
'X-Sign-For': sign(params, {
appKey: '1274560575',
}),
},
})
.then(() => setResult('success'))
.catch(() => setResult('failed'));
};
const postJSON = (name) => {
setResult('...');
const data = JSON.parse(JSON.stringify({ name }));
business
.request({
url: REST_URL.examSubmit,
data,
method: 'POST',
headers: {
'Content-Type': 'application/json; charset=utf-8',
appKey: '1274560575',
'X-Sign-For': sign(data, {
appKey: '1274560575', postAndJSON: true
}),
},
})
.then(() => setResult('success'))
.catch(() => setResult('failed'));
};
return (
<div>
<button type="button" onClick={() => req(String.fromCharCode(28010))}>
first button
</button>
<button type="button" onClick={() => req(String.fromCharCode(63786))}>
second button
</button>
<button type="button" onClick={() => postJSON(String.fromCharCode(28010))}>
third button
</button>
<button type="button" onClick={() => postJSON(String.fromCharCode(63786))}>
forth button
</button>
<dir>{result}</dir>
</div>
);
}