Skip to content

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

Closed

Description

@ChitaGideon

在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...
})();

Activity

  1. CodFrm commented on Jan 11, 2022

    @CodFrm
    Member

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

  2. CodFrm commented on Jan 11, 2022

    @CodFrm
    Member

    支持 71a039f

  3. ChitaGideon commented on Jan 12, 2022

    @ChitaGideon
    Author

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

  4. CodFrm commented on Jan 12, 2022

    @CodFrm
    Member

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

  5. CodFrm commented on Jan 12, 2022

    @CodFrm
    Member

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

  6. ChitaGideon commented on Jan 12, 2022

    @ChitaGideon
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions