Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request body panel #21

Merged
merged 7 commits into from
Jul 21, 2024
Merged

Request body panel #21

merged 7 commits into from
Jul 21, 2024

Conversation

danirod
Copy link
Owner

@danirod danirod commented Jul 6, 2024

This is my attempt at #14.

It changes the body tab contents with a more complex widget that has a encoding selection. By default it is set to None, but there are multiple selections:

  • None. Empties the widget, it is not possible to attach a body.
  • URL Encoded. Will provide a key-value editor similar to the ones in Headers and Variables to encode the form body in URL Encoded format (name=John&surname=Doe).
  • Multipart Form Data. Will encode the key-valued items as a form data, in the future this will allow to attach files.
  • JSON, XML and Raw: they use the same classic GtkSourceView editor, but each one will use syntax highlighting towards a different colorscheme.

There is now a polymorphic class tree with different widgets that implement the same trait, allowing the tab to just call payload() to get the payload set by the user, no matter the kind of body that is being used. This will be used in the future for collections as well.

No body

JSON body

XML body

@danirod danirod self-assigned this Jul 6, 2024
@danirod danirod linked an issue Jul 6, 2024 that may be closed by this pull request
@danirod danirod added this to the 0.1 milestone Jul 6, 2024
@danirod danirod force-pushed the request-body-panel branch 2 times, most recently from de74a13 to 22a2b2b Compare July 17, 2024 18:32
danirod added 6 commits July 20, 2024 23:40
There are two GObject classes now: BasePayloadPane is the top level
abstract class and RawPayloadPane is the implementation.

BasePayloadPane defines a property called `payload`. Each implementation
shall define its own getter and setter to allow other widgets to take or
set the contents of the pane, but each implementation is free to do so
on its own way. The RawPayloadPane just takes and sets the SourceView
buffer contents, but other implementations may parse the byte array
differently.
The tabs will extract the proper payload pane that is visible and use
the polymorphic methods to get the payload for that specific pane. A
combo box will let the user set the format, and that will cause a
different pane to be presented.
@danirod danirod force-pushed the request-body-panel branch from 22a2b2b to 96548ba Compare July 21, 2024 15:48
@danirod danirod marked this pull request as ready for review July 21, 2024 15:48
So that I can detect when the file is dirty
@danirod danirod merged commit 466e375 into trunk Jul 21, 2024
2 checks passed
@danirod danirod deleted the request-body-panel branch July 25, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple request encodings
1 participant