feat: support reading http response headers #138
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-example: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/libextism | |
- name: Install Zig | |
uses: goto-bus-stop/setup-zig@v2 | |
- name: Check Zig Version | |
run: zig version | |
- name: Compile example | |
run: | | |
zig build basic_example | |
- name: Test example | |
run : | | |
TEST=$(extism call zig-out/bin/basic-example.wasm --input "this is a test" --set-config='{"thing": "1", "a": "b"}' --log-level=debug count_vowels | jq) | |
echo $TEST | grep '"count": 4' | |
echo $TEST | grep '"config": "1"' | |
echo $TEST | grep '"a": "this is var a"' | |
TEST=$(extism call zig-out/bin/basic-example.wasm http_get --allow-host '*') | |
echo $TEST | |
echo $TEST | grep 'user=1' | |
TEST=$(extism call zig-out/bin/basic-example.wasm greet --config user=Benjamin) | |
echo $TEST | |
echo $TEST | grep 'Hello, Benjamin!' | |
TEST=$(extism call zig-out/bin/basic-example.wasm greet 2>&1 || true) | |
echo $TEST | |
echo $TEST | grep "Error: This plug-in requires a 'user' key in the config" | |
TEST=$(extism call zig-out/bin/basic-example.wasm add --input='{"a": 20, "b": 21}') | |
echo $TEST | grep '{"sum":41}' | |
TEST=$(extism call zig-out/bin/basic-example.wasm count --loop '3') | |
echo $TEST | grep '1' | |
echo $TEST | grep '2' | |
echo $TEST | grep '3' | |
TEST=$(extism call zig-out/bin/basic-example.wasm log_stuff --log-level 'debug' 2>&1) | |
echo $TEST | grep 'An info log!' | |
echo $TEST | grep 'A debug log!' | |
echo $TEST | grep 'A warning log!' | |
echo $TEST | grep 'An error log!' | |
TEST=$(extism call zig-out/bin/basic-example.wasm json_input --input '{"name": "Yoda", "age": 900}') | |
echo $TEST | grep 'Hello, Yoda. You are 900 years old!' | |
TEST=$(extism call zig-out/bin/basic-example.wasm json_output) | |
echo $TEST | grep '["first thing","second thing","third thing"]' | |
TEST=$(extism call zig-out/bin/basic-example.wasm nested_json --input '{"innerCount": 3}') | |
COUNT=$(echo $TEST | jq | grep "I'm the inner struct" | wc -l) | |
test $COUNT -eq 3 | |
TEST=$(extism call zig-out/bin/basic-example.wasm http_get --input '' --allow-host jsonplaceholder.typicode.com --enable-http-response-headers --log-level debug 2>&1) | |
echo $TEST | grep "application/json; charset=utf-8" |