@@ -6,33 +6,41 @@ ls -la *
66
77tar -xvzf ./distributables/v* /httptoolkit-server-* -$1 -x64.tar.gz
88
9- echo " Starting server..."
9+ echo " \nStarting server..."
1010
1111./httptoolkit-server/bin/httptoolkit-server start &
1212SERVER_PID=$!
1313
1414sleep 5
1515
16- echo " Testing server..."
16+ echo " \nTesting server..."
1717
1818# CSRF protection fully blocks unrecognized/missing origin requests:
19+ CURL_OPTIONS=" --silent --fail -i"
1920WITH_ORIGIN=" -HOrigin: https://app.httptoolkit.tech"
2021AS_JSON=" -HContent-Type: application/json"
2122
22- # Can start a Mockttp server:
23- curl " $WITH_ORIGIN " " $AS_JSON " -v --fail ' http://127.0.0.1:45456/start?port=\{"startPort":8000,"endPort":65535\}' -d ' {}'
23+ echo " \nCan start a Mockttp server" ?
24+ # Uses the default config from the UI:
25+ curl $CURL_OPTIONS " $WITH_ORIGIN " " $AS_JSON " ' http://127.0.0.1:45456/start' \
26+ --data ' {"plugins":{"http":{"options":{"cors":false,"suggestChanges":false,"http2":"fallback","https":{"tlsPassthrough":[]}}},"webrtc":{}}}'
2427
25- # Can query the API server version:
26- curl " $WITH_ORIGIN " " $AS_JSON " -v --fail http://127.0.0.1:45457/ -d ' {"query": "query getVersion { version }"}'
28+ echo " \nCan query the API server version?"
29+ curl $CURL_OPTIONS " $WITH_ORIGIN " " $AS_JSON " http://127.0.0.1:45457/ \
30+ --data ' {"query": "query getVersion { version }"}'
2731
28- # Can get config
29- curl " $WITH_ORIGIN " " $AS_JSON " -v --fail http://127.0.0.1:45457/ -d ' {"query": "query getConfig { config { certificateContent certificatePath certificateFingerprint } }"}'
32+ echo " \nCan get config?"
33+ curl $CURL_OPTIONS " $WITH_ORIGIN " " $AS_JSON " http://127.0.0.1:45457/ \
34+ --data ' {"query": "query getConfig { config { certificateContent certificatePath certificateFingerprint } }"}'
3035
31- # Can query interceptors
32- curl " $WITH_ORIGIN " " $AS_JSON " -v --fail http://127.0.0.1:45457/ -d ' {"query": "query getInterceptors { interceptors { id version, metadata isActivable isActive(proxyPort: 8000) } }"}'
36+ echo " \nCan query interceptors?"
37+ curl $CURL_OPTIONS " $WITH_ORIGIN " " $AS_JSON " http://127.0.0.1:45457/ \
38+ --data ' {"query": "query getInterceptors { interceptors { id version, metadata isActivable isActive(proxyPort: 8000) } }"}'
3339
34- # Can trigger update (can't test that it actually updates, unfortunately)
35- curl " $WITH_ORIGIN " " $AS_JSON " -v --fail http://127.0.0.1:45457/ -d ' {"query": "mutation TriggerUpdate { triggerUpdate }"}'
40+ echo " \nCan trigger update?"
41+ # (can't test that it actually updates, unfortunately)
42+ curl $CURL_OPTIONS " $WITH_ORIGIN " " $AS_JSON " http://127.0.0.1:45457/ \
43+ --data ' {"query": "mutation TriggerUpdate { triggerUpdate }"}'
3644
3745# ^ This will fail if they receive anything but a 200 result.
3846# This ensures that the server is startable, and has minimal functionality for launch.
0 commit comments