Getman+

Getman HTTP接口请求模拟测试工具增强插件,在线Postman,在线Curl,支持Cookie、本地内网跨域请求 Restful接口测试

Stan na 11-05-2020. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Getman+
// @namespace    Getman.cn
// @version      1.0
// @description  Getman HTTP接口请求模拟测试工具增强插件,在线Postman,在线Curl,支持Cookie、本地内网跨域请求 Restful接口测试
// @author       Getman.cn
// @match        https://getman.cn/*
// @grant        GM_xmlhttpRequest
// @connect      *
// @run-at       document-end
// @homepage     https://getman.cn/
// @icon         https://getman.cn/img/icon.png
// @supportURL   https://getman.cn/
// ==/UserScript==

(function () {
    'use strict';
    var delay = 500;
    var timeout = 10000;
    setTimeout(function () {
        if (typeof (unsafeWindow.localRequest) === 'function') {
            unsafeWindow.localRequest = function () {
                GM_xmlhttpRequest({
                    method: unsafeWindow.request.request.method,
                    url: unsafeWindow.request.request.url.raw,
                    headers: Object.assign({}, unsafeWindow.request.request.header),
                    data: unsafeWindow.request.request.body,
                    timeout: timeout,
                    onload: function (res) {
                        unsafeWindow.request.response.code = res.status || 0;
                        unsafeWindow.request.response.status = res.statusText || '';
                        unsafeWindow.request.response.header = unsafeWindow.kvStringToObject(res.responseHeaders || '');
                        unsafeWindow.request.response.body = res.responseText || '';
                        unsafeWindow.showResponseData(res);
                    },
                    onerror: function (res) {
                        unsafeWindow.request.response.code = res.status || 0;
                        unsafeWindow.request.response.status = res.statusText || '';
                        unsafeWindow.request.response.header = unsafeWindow.kvStringToObject(res.responseHeaders || '');
                        unsafeWindow.request.response.body = res.responseText || '';
                        unsafeWindow.showResponseData(res);
                    },
                    ontimeout: function (res) {
                        unsafeWindow.request.response.code = res.status || 0;
                        unsafeWindow.request.response.status = res.statusText || '';
                        unsafeWindow.request.response.header = unsafeWindow.kvStringToObject(res.responseHeaders || '');
                        unsafeWindow.request.response.body = res.responseText || '';
                        unsafeWindow.showResponseData(res);
                    }
                });
            }
        }

    }, delay);

})();