Giter Club home page Giter Club logo

protoman's Introduction

Protoman

A Postman-like API client for protobuf-based messages.

Usage

  1. Register your .proto files to enable protobuf-related features. Right click on the collection, select 'Manage .proto files' to register the file paths.

  1. The rest of the request-building interface is similar to Postman.

    a. Enter your good old http request parameters (method, url, headers)

    b. Select request/response proto messages you want.

    c. Fill out the fields in your request proto message.

    d. Click send.

    e. The response is shown below the request section.

  1. As of version 0.2.0, you can also set up environments, and reuse variables there throughout your requests on the top-right corner!

  1. As of version 0.3.0, you can also import / export collections as JSON
  • When importing a collection, all the proto definitions / path to .proto files are also imported. Hence, it's recommended to fix the paths to keep the proto definitions up-to-date.
  • Note that it's not compatible with Postman collections.
  1. As of version 0.4.0, you can also reorder requests / set different expected messages for success(2XX) and failures(others)

  2. That's it for the current version. Enjoy and leave a star if you like it !

Installation

Mac

Protoman-0.4.0.dmg

Windows

Protoman Setup 0.4.0.exe - Unlike mac, I don't currently own a license to sign the app. So it might give you some security warnings!

Linux

Protoman-0.4.0.AppImage

As a fallback, you can clone the repo and run npm install && npm run build to build, and npm run start to launch the app. Or, you can actually find configurations on electron builder to get the right distribution version yourself!

Contributing

If you are interested in reporting/fixing issues and contributing directly to the codebase, follow the standard procedures.

  1. Create an issue.
  2. Fork the repo.
  3. Submit a PR.
  4. We'll get back to you as soon as we can!

Make sure to run npm run lint before submitting your PR!

Licence

MIT

protoman's People

Contributors

dependabot[bot] avatar donghunlouislee avatar kolmant avatar majdghada avatar spluxx avatar vorte avatar wwenbow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

protoman's Issues

Json ContentType with ;charset=utf-8 is not recognized

Hello,

While I'm testing my application, I found out that the result is not shown in the response view because the type is not json but application/json;charset=utf-8

So created a patch that can fix it:

Index: src/core/http_client/client.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/core/http_client/client.ts b/src/core/http_client/client.ts
--- a/src/core/http_client/client.ts	(revision 521b4ac5069fb5d748edf2f373b6cd5f5bc5dceb)
+++ b/src/core/http_client/client.ts	(date 1642675334155)
@@ -47,7 +47,7 @@
   if (buf.length === 0) {
     responseBodyType = 'empty';
     responseBodyValue = undefined;
-  } else if (saidContentType === CONTENT_TYPE_JSON) {
+  } else if (saidContentType?.includes(CONTENT_TYPE_JSON)) {
     responseBodyType = 'json';
     responseBodyValue = toJson(buf);
   } else if (saidContentType?.includes(CONTENT_TYPE_HTML)) {


This will recognize CONTENT_TYPE_JSON

Blank UI

Problem
Cannot submit my request due to blank UI

Steps:

  1. Create New Request
  2. Jot down the values needed for your request under Body tab
  3. Refresh
  4. Click again the Body tab

Expected Output
GUI is still visible, can edit values and send request

Actual Output
Blank page
image

image

I have noticed the request is working fine if we refresh it first then submit it, though this is another issue you need to fix. :)

Hope to support Pre-script

Hope to support pre-script like postman, which can greatly improve the efficiency of the test, and the access_token can be automatically obtained in advance before the request is sent

Not sure how to use field with type "bytes"

I am sending requests using a protobuf message which has a field with type bytes - specifically image bytes. I convert the image to bytes using a Python script and get the following output:

\xff\xd8\xff\xe0\x00\x10JFIF[...]

This, I then input to the bytes field in Protoman:

Screenshot 2023-06-28 at 13 12 36

I would expect that exactly the same \xff\xd8\xff\xe0\x00\x10JFIF is transferred to the server, but what I get at the server side is:

\xc5\xf7\xf1w\xcc_\x7f\x17\xb4\xc7M1\xd7BE

I assume this has to do with the representation the data is in, I am inputting a byte string. What does the byte type actually expect?

Datatypes check

Protoman does not support data types check.
when I pass string where int is required, it should throw an error, but this does not happen right now.

HTTPS POST is failing with certificate error

I am trying to do a POST on an HTTPS address but getting the following error whereas the certificate has been imported into the ca-trusts as well in the browser.

failed, reason: self signed certificate in certificate chain

Kindly let me know if there is way to bypass certificate validation or where to import the certificate to resolve the issue.

Operating system: CentOS 7

Finish Environments

The views/models for configuring environments are ready, but we haven't done 2 things, so the feature is currently disabled (in the top right corner)

  1. Replacing variables wrapped in double curly braces with the ones from the current environment.

As in, if the current environment has

hostname: 'localhost:3000'

and the url string is {{hostname}}/api/do_something, the request should be sent to localhost:3000/api/do_something. The replacement logic should be applied to every single strings where possible - url, headers, message values.

After this is done, this feature would be enabled

  1. Highlighting (orange if the variable exists in the current environment, red if it doesn't), and showing the current environment value when the user hovers on top of those double curly braces.

This would mean that we'd have to create our own Input component that fits well with ant design's theme, so a bit more work is expected than the first one.

The given content-type is unsupported.

Hello, I am returning a content-type application/x-protobuf but getting content-type is unsupported. Which content-type does Protoman expect? The Request correctly serializes the protobuffer from the managed collection.

Thanks

how to allow certificate issue

for some URL's in postman tool, it ask for allow the request...which is not available in Protoman..

how to fix it.
reason: unable to verify the first certificate

Improved error messages & visibility

Suggested by @DoneSpeak #13

Errors like index out of range: 128 + 10 > 128 is somewhat cryptic, but it seems like the main library considers it sufficient. protobufjs/protobuf.js#691 (comment)

In a high-level view, the protobuf-related logic consists of 4 components.

  1. parsing .proto files
  2. binary <-> object
  3. object <-> view model
  4. view model <-> view

1 and 2 are done through protobufjs, so I think we can just build a lightweight module that takes in a protobufjs error and returns a more friendly error.

3, if it fails for some unexpected reason, we should still display the object rather than just giving up, so that the users can debug the issue.

Url input fix width

Url input has some weird width:
image

if input width will be 100% then it is ok:
image

Large int64 values are truncated

I have a locationId field in my proto which is a fixed64 type, and am trying to request location ID 1234577704719498930

The server is instead receiving a request for location ID 1234577704719499008

Having run into this with some web frontends, my best guess is that Protoman is using a javascript Number internally, which only supports 53 bits, so it's truncating the integer input. This can probably be fixed by using BigInt instead of Number.

More flexible export for a collection

For now when I export a collection, paths to proto files most probably will not work on other machines as its are absolute paths on a machine where I create them.

For example:

"protoFilepaths": [
    "<absolute_path>"
],

I would like to not rely on local path and possible solutions I see for that:

  1. Ability to point to a file accessible via http
  2. During export add all files to export

On top of that I can suggest attacking the problem from a different point:
Now I need to export all files one by one but probably it makes sense to export the whole directory and Protoman can recursively find all proto definition. In that case other people can (only once) just point to the directory with definitions and other future changes will not require from them to export new files.

Or instead of directory maybe it's possible to add a jar dependency

Failed when I try to add a proto file with import syntax.

Protoman-0.3.1.dmg

image

Failed when I try to add the following protos.

account/api/account_test.proto -> Protobuf cannot be read

syntax = "proto3";

import "account/data/account.proto";

message AccountList {
    repeated account.data.Account accounts = 1;
}

account/data/account.proto -> Added successfully.

syntax = "proto3";

package account.data;

import "common/valid.proto";

message Account {
    int64 account_id = 1;
    string first_name = 2 [(valid.pattern) = "[a-zA-Z]{5,20}"];
    string last_name = 3 [(valid.pattern) = "[a-zA-Z]{5,20}"];
    string email = 4 [(valid.email) = true];
    string phone = 5 [(valid.pattern) = "[a-zA-Z]{5,20}"];
}

Optional fields are filled with default empty values

Let's say we have the following schema:

message UpdatePostPayload {
    optional string title = 1;
    optional string content = 2;
    optional string cover = 3;
}

The request message form will include this fields and when it's sent and parsed on the server this fields will exists with default empty values (empty strings in this example). It would be nice to be able to have checkbox or someting to specify which optional fields should be used or not. So when optional field doesn't have any value and it's unchecked (i.e. "don't use this field") - we will not get this empty values on the server.

Clone (copy) request

It would be great if I could clone request,
Won't need to write all headers every request and work would be much faster.

Submit form data

Possibility to send form-data like in Postman, not only proto. With 2 types of fields - text and file.

Feature request: JSON Body

Hi!

I don't know if this is implemented or not, but it would be super useful if we would send the HTTP request body as JSON. Today, only Protobuf is an alternative for sending requests and JSON is a good alternative for sending request as there are short and simple.

Thanks,

Blank UI - while opening

Hi

Why do i get blank screen?

I see some json errors in the console.
"Uncaught SyntaxError: Unexpected token in JSON at position 0
at JSON.parse ()
at renderer.js:275
at EventEmitter. (renderer.js:275)
at EventEmitter.emit (events.js:210)
at Object.onMessage (init.ts:50)

image

Ability to not pass implicit headers "application/x-protobuf" to the request

One of the apis (that requires protobuf encoded payload over http) I'm testing accepts content-type as ONLY binary/octet-stream.

Hence I'm passing the header from protoman like this:
image

But when I make the request, the service is receiving content-type as binary/octet-stream,application/x-protobuf. I guess that means Protoman is attaching application/x-protobuf in the header. Due to this, the api call fails.

Can this implicit passing of application/x-protobuf be removed or made optional?

Automated Collection Testing

Once the user defines(and saves) the collection, user can just click a button to test all the requests within that collection at once.
Further discussion needed whether protoman will just check the status code or the actual return(users can decide if they want to)

support Snappy content encoding

Prometheus uses Snappy encoded Protobuf over HTTP. I wanted to use Protoman to test some functionality with the remote write api in prometheus, but it expects snappy encoded protobuffers and sends back snappy encoded (content-encoding) protobuffers.

there are a few snappy javascript libraries to choose from

DEV testing

hi , i run yarn dev , but dont open nothing , and localhost:3000 is a blank page
where can I test?

Expose more request configuration

The http client implementation that we're using is node-fetch.

A good start for this feature would be to

  1. Add a field that holds a list of (config name, value) to the model request_builder.ts.
  2. Create a tab for configuration next to the expected message
  3. Create Action/Reducer to link up the view / storage
  4. Include those options on request.ts - either pre-fetch, during fetch, or post-fetch.

We can start with simple ones available from node-fetch:

  • follow
  • compress

Support for protobuf Any

Hi,

It would be nice if you can add support for protobuf message type Any. For example, I could send my protobuf message type 'Foo' in a request that takes a message of type Any.

Regards,
Irfan

Reordering request

Need possibility to reorder request in collection or at least requests should be sorted by name.

Folder-level import

Suggested by @DoneSpeak #13

In some projects, the protobuf files are separated into various folders - an example project structure would be

-- service1
     |- service1.proto (imports models)
-- service2
     |- service2.proto (imports models / service1)
-- core
     |- models.proto
-- 

Although the proto_path feature introduced in v0.3.2 makes it possible to build these files together, an easy way to import all .proto files in a folder is yet to be delivered.

My take on this problem is to allow selection of the root directory, which

  1. sets the proto_path to the selected path and
  2. adds all .proto files under it

It might even make sense to enforce this to be the only way to import the .proto files, and make the proto_path implicit rather than having the users pick the files one by one and type the proto_path in. But I'll have to dig into the protoc docs and make sure this doesn't block certain project structures.

windows don't save size when turn off

Hi!
After resizing as desired but when closing the application and restarting, the window size is back to the same.
I need save size windows when turn off
My OS: Ubuntu Desktop 20.04
thanks

Collection folders

Nice to have: create folders for requests in collections like in Postman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.