cedric05 / dothttp

dsl for http. https://marketplace.visualstudio.com/items?itemName=ShivaPrasanth.dothttp-code
https://docs.dothttp.dev/
Apache License 2.0
12 stars 0 forks source link

pluggable approach for request transformation #150

Open cedric05 opened 2 years ago

cedric05 commented 2 years ago

There are scenarios where running custom transformations before making a http request, ideally test_script is a way to write those out.

Not all transformations can be written in test_script, there should be a way for dothttp to figure out plugin and load those plugin and apply those tranformations easily.

This way users can write their own custom plugins, install and use.

cedric05 commented 2 years ago

Http item can have a syntax like

@plugin("<pluginid>", ["list of arguements"])
GET "https://httpbin.org/get"

using pluginid, dothttp will load that plugin and apply that transformation.

For example:

GET "https://httpbin.org/get"

hawkauth plugin will apply headers.

cedric05 commented 9 months ago

For Plugin after researching here is the plan, i think would make sense

aws concepts

AWS lambda uses packaged .zip files to load lamdba function defined.

aws sam uses package to package lamdba python function to ease deployment.

ref: https://github.com/aws/aws-sam-cli/blob/develop/samcli/commands/package/command.py

cedric05 commented 9 months ago

module built via pyinstaller (like dothttp) can load packages from by appending path to packages to sys.path. after that, module can be loaded via importlib.import_module('package').