Kong / apiembed

Embeddable API code snippets for your website, blog or API documentation
https://apiembed.com
MIT License
410 stars 52 forks source link

Support Data Urls or another way to embed the HAR directly #16

Open johncrenshaw opened 9 years ago

johncrenshaw commented 9 years ago

The current method for passing HAR data to the apiembed server is clunky and/or hard to use in cases where the HAR information is available at page load, or is generated at runtime, or when debugging an integration from a local development environment (which is not visible to external servers).

Some way of embedding the HAR data directly in the request would be extremely helpful in these situations. Data urls (which currently don't work) seem like an obvious choice, are completely backwards compatible, and require no additional parameters or interface changes.

The support for data urls could be done either at the unirest level, or by checking the source parameter before sending it to unirest, and decoding it directly if it is a data url.

Alternately an "har" parameter or similar which accepts the har data directly, and is mutually exclusive with the source parameter, would work.

I can submit a pull request with the necessary changes if there is any interest in either form of this functionality.