https://github.com/brandonh-msft/azure-function-compress-decompress
An Azure Function that compresses & decompresses payload POSTed to it
https://github.com/brandonh-msft/azure-function-compress-decompress
Last synced: 3 months ago
JSON representation
An Azure Function that compresses & decompresses payload POSTed to it
- Host: GitHub
- URL: https://github.com/brandonh-msft/azure-function-compress-decompress
- Owner: brandonh-msft
- Created: 2019-08-22T07:31:48.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-22T08:41:30.000Z (over 5 years ago)
- Last Synced: 2025-01-14T08:52:18.390Z (4 months ago)
- Language: C#
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compress/Decompress Azure Function
This Azure Function will compress a payload POSTed to it using gzip, then base64 encode the compressed value and return it as the body of a 200 OK response.
## Example Compress call
~~~
POST /api/Compress HTTP/1.1
Host: localhost:7071
Content-Type: text/plain
Accept: */*
Cache-Control: no-cache
Host: localhost:7071
Accept-Encoding: gzip, deflate
Content-Length: 19
Connection: keep-alive
cache-control: no-cachecompress my string!
~~~Returns 200 OK:
~~~
H4sIAAAAAAAAC0vOzy0oSi0uVsitVCguKcrMS1cEAGyldeQTAAAA
~~~## Example Decompress call
~~~
POST /api/Decompress HTTP/1.1
Host: localhost:7071
Content-Type: text/plain
Accept: */*
Cache-Control: no-cache
Host: localhost:7071
Accept-Encoding: gzip, deflate
Content-Length: 52
Connection: keep-alive
cache-control: no-cacheH4sIAAAAAAAAC0vOzy0oSi0uVsitVCguKcrMS1cEAGyldeQTAAAA
~~~Returns 200 OK:
~~~
compress my string!
~~~## Unit Tests
The xUnit-based UTs in this project exercise the `Compress` Function, the `Decompress` Function, and ensure a round-trip results in a match to the initial input. Additionally, round-trip testing is done with known "problematic" international characters to ensure the encode/decode doesn't break things.