Skip to content

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

@ChitaGideon

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

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