Zotero.HTTP.request return empty ArrayBuffer in response when set responseType as 'arraybuffer'

Reproduce steps:
1. In menu bar, click "Tools -> Developer -> Translator Editor";
2. Click "+" icon, "Insert Template -> Web Translator";
3. In "Browser" tab, go to "https://d.wanfangdata.com.cn/periodical/hgxb2019z1002"
4. In doWeb(), paste:

const requestData = decoder.decode(new Uint8Array([0, 0, 0, 0, 27, 10, 10, 80, 101, 114, 105, 111, 100, 105, 99, 97, 108, 18, 13, 104, 103, 120, 98, 50, 48, 49, 57, 122, 49, 48, 48, 50]));
const respond = await request('/Detail.DetailService/getDetailInFormation', {
method: 'POST',
body: requestData,
headers: {
'Content-Type': 'application/grpc-web+proto', Referer: url },
responseType: 'arraybuffer'
});
Z.debug(respond.body);

5. Run doWeb to see the output.

Alternatively, can use a node package called "express" to create a local server that sends an arrayBuffer, and then use the "Tools ->Run JavaScript" in Zotero menu bar to test it.
  • Development questions and requests should be posted on the zotero-dev mailing list. Please elaborate more about what you're trying to achieve, what happens now and what and why you expect to happen instead.
Sign In or Register to comment.