mock Web server を立てる
request を錄音する
VCRRuby.icon
Vcr 6.1.0 - Vcr - VCR - Relish
vcr/vcr: Record your test suite's HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.
Ruby.icon以外にもいっぱい移植されてるでよ
MSW – Seamless API mocking library for browser and Node | Mock Service Worker
API schema に適合した server を立てる
response は、default 値だったり、property based testing じみて random 生成だったり
OpenAPIOpenAPI.icon
jormaechea/open-api-mocker: A mock server based in OpenAPI Specification
muonsoft/openapi-mock: OpenAPI mock server with random data generation
GraphQLGraphQL.icon
ardatan/graphql-tools: Build, mock, and stitch a GraphQL schema using the schema language
gRPCgRPC.icon
Adven27/grpc-wiremock: gRPC Mock Server
file を供するだけなら
$ bb '(org.httpkit.server/run-server (fn [{:keys uri}] (let f (clojure.java.io/file (str "." uri)) (if (and (.isFile f) (.canRead f)) {:status 200 :body (slurp f)} {:status 404}))) {:port 8000}) (async/<!! (async/chan))'
Babashka.icon
$ npx http-server . -p 8000
Node.js.icon
$ ruby -run -e httpd -- --port=8000 .
Ruby.icon
$ bash -eux -c "c=\$(mktemp); echo 'events {} http { server { listen 8000; location / { root \"$(pwd)\"; } } }' > \$c; nginx -g 'daemon off;' -c \$c -e stderr"
Nginx.icon
$ erl -noshell -eval 'ok = inets:start(), {ok, _} = inets:start(httpd, {port, 8000}, {server_name, "tmp"}, {server_root, "."}, {document_root, "."}).'
Erlang.icon