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

GM_xmlhttpRequest 提交blob的时候有问题 #29

Closed
ChitaGideon opened this issue Jan 11, 2022 · 6 comments
Closed

GM_xmlhttpRequest 提交blob的时候有问题 #29

ChitaGideon opened this issue Jan 11, 2022 · 6 comments

Comments

@ChitaGideon
Copy link

在tampermonkey 和scriptcat里行为不一样;
scriptcat里没有提交上去,好像只提交了一个[object object]字符串

// ==UserScript==
// @name         test Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http*://*/*
// @icon         https://www.google.com/s2/favicons?domain=httpbin.org
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function () {
    'use strict';
    const url = 'http://httpbin.org/image/jpeg'
    GM_xmlhttpRequest({
        method: 'GET',
        url: url,
        responseType: "blob",

        onload: function (req) {
            console.log(req.status, req.response, typeof req.response)
            GM_xmlhttpRequest({
                method: 'PUT',
                url: 'http://httpbin.org/anything',
                data: req.response,
                onload: function (req) {
                    console.log(req.status, req.response)
                }
            })

        }
    });

    // Your code here...
})();
@CodFrm
Copy link
Member

CodFrm commented Jan 11, 2022

知道了,scriptcat还没有支持blob的数据,data暂时只能支持string | FormData,这两天处理一下

@CodFrm
Copy link
Member

CodFrm commented Jan 11, 2022

支持 71a039f

@CodFrm CodFrm closed this as completed Jan 11, 2022
@ChitaGideon
Copy link
Author

这么快的吗,ArrayBuffer 要不要也顺便补上呢?

@CodFrm
Copy link
Member

CodFrm commented Jan 12, 2022

也可以,直接内部转换成blob就行,不过我看tm他们好像是不支持ArrayBuffer的?

@CodFrm
Copy link
Member

CodFrm commented Jan 12, 2022

虽然时间不多,但是一些兼容性的问题还是会尽快处理更新的

@ChitaGideon
Copy link
Author

好的, 那我就等下一个版本更新试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants