[GH-ISSUE #717] [Feature Request] Support Other Serialization Schemes/Formats #715

Closed
opened 2026-03-03 19:21:14 +03:00 by kerem · 2 comments
Owner

Originally created by @VaslD on GitHub (Dec 5, 2020).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/717

Originally assigned to: @NghiaTranUIT on GitHub.

Description

Are there plans for decoding other serialization formats besides Protobuf, for example MessagePack, directly in Proxyman app?

(Or maybe this could be achieved by plugins—I would gladly write one though it may take some time—if the planned plugin architecture supports this type of functionality.)

Originally created by @VaslD on GitHub (Dec 5, 2020). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/717 Originally assigned to: @NghiaTranUIT on GitHub. ### Description Are there plans for decoding other serialization formats besides Protobuf, for example MessagePack, directly in Proxyman app? (Or maybe this could be achieved by plugins—I would gladly write one though it may take some time—if the planned plugin architecture supports this type of functionality.)
kerem closed this issue 2026-03-03 19:21:14 +03:00
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 6, 2020):

Hi, it's possible for now if you use the Scripting feature.

From what I research, you can download mspack.min.js (https://github.com/ygoe/msgpack.js) and use it as a Scripting Addon, then decoding the binary data and set as a Response Body again.

Here is a quick tutorial (Please notes that I haven't tested it, but in general it should work)

  1. Download msgpack.min.js and put it in ~/Library/Application Support/com.proxyman.NSProxy/addons/libs/ folder
  2. Create new addon. let call it messagepack.js in ~/Library/Application Support/com.proxyman.NSProxy/addons/ with the following content:
/**
    {
        "name":"My Awesome Addon",
        "description":"The first User Addons",
        "author":"Proxyman",
        "tags":"helloworld"
    }
**/

const msgpack = require("@libs/msgpack.min.js");
const { atob } = require("@addons/Base64.js")

const decode = (data) => {
    // Convert base64 string to bytes array
    var bytes = atob(data)

    // Decode to JSON String
    return msgpack.deserialize(bytes);
};

// Make sure you export the function at the end of method
exports.sayHello = decode;
  1. Then creating new script to match your request. You can use decode MessagePack to JSON like:
// Addons List: https://docs.proxyman.io/scripting/addons
const { sayHello } = require("@addons/HelloWorld.js");
const { decode } require("@addons/messagepack.js")

function onRequest(context, url, request) {
  // console.log(request);
  console.log(url);

  // Set JSON, so it can render JSON in Proxyman
  request.headers["Content-Type"] = "application/json";
  
  // Body
  var body = request.body;
  request.body = decode(body);

  // Done
  return request;
}

function onResponse(context, url, request, response) {

  // Update or Add new headers
  response.headers["Content-Type"] = "application/json";

  // Update Body
  var body = response.body;
  response.body =  decode(body);

  // Done
  return response;
}

You can check out many Snippet Code to know how to manipulate the Request/Response data

<!-- gh-comment-id:739443697 --> @NghiaTranUIT commented on GitHub (Dec 6, 2020): Hi, it's possible for now if you use the Scripting feature. From what I research, you can download mspack.min.js (https://github.com/ygoe/msgpack.js) and use it as a [Scripting Addon](https://docs.proxyman.io/scripting/write-your-own-addons), then decoding the binary data and set as a Response Body again. Here is a quick tutorial (Please notes that I haven't tested it, but in general it should work) 1. Download `msgpack.min.js` and put it in `~/Library/Application Support/com.proxyman.NSProxy/addons/libs/` folder 2. Create new addon. let call it `messagepack.js` in `~/Library/Application Support/com.proxyman.NSProxy/addons/` with the following content: ```js /** { "name":"My Awesome Addon", "description":"The first User Addons", "author":"Proxyman", "tags":"helloworld" } **/ const msgpack = require("@libs/msgpack.min.js"); const { atob } = require("@addons/Base64.js") const decode = (data) => { // Convert base64 string to bytes array var bytes = atob(data) // Decode to JSON String return msgpack.deserialize(bytes); }; // Make sure you export the function at the end of method exports.sayHello = decode; ``` 3. Then creating new script to match your request. You can use decode MessagePack to JSON like: ```js // Addons List: https://docs.proxyman.io/scripting/addons const { sayHello } = require("@addons/HelloWorld.js"); const { decode } require("@addons/messagepack.js") function onRequest(context, url, request) { // console.log(request); console.log(url); // Set JSON, so it can render JSON in Proxyman request.headers["Content-Type"] = "application/json"; // Body var body = request.body; request.body = decode(body); // Done return request; } function onResponse(context, url, request, response) { // Update or Add new headers response.headers["Content-Type"] = "application/json"; // Update Body var body = response.body; response.body = decode(body); // Done return response; } ``` ---------- You can check out many [Snippet Code](https://docs.proxyman.io/scripting/snippet-code) to know how to manipulate the Request/Response data
Author
Owner

@VaslD commented on GitHub (Dec 6, 2020):

Thank you for the detailed explanation.

I’ll try it out. Closing it for now.

<!-- gh-comment-id:739466098 --> @VaslD commented on GitHub (Dec 6, 2020): Thank you for the detailed explanation. I’ll try it out. Closing it for now.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#715
No description provided.