https://github.com/xnbox/DeepfakeHTTP Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} xnbox / DeepfakeHTTP * Notifications * Star 1 * Fork 0 DeepfakeHTTP is an HTTP server that uses HTTP dumps as a source for responses. xnbox.github.io/deepfakehttp#readme MIT License 1 star 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 1 branch 1 tag Code * Clone HTTPS GitHub CLI [https://github.com/x] Use Git or checkout with SVN using the web URL. [gh repo clone xnbox/] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @xnbox xnbox Features list updated ... 7705c17 Aug 21, 2021 Features list updated 7705c17 Git stats * 26 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time META-INF Initial commit Aug 21, 2021 WEB-INF Initial commit Aug 21, 2021 lib-compile-time Initial commit Aug 21, 2021 lib Initial commit Aug 21, 2021 src Initial commit Aug 21, 2021 .classpath Initial commit Aug 21, 2021 .gitignore Initial commit Aug 21, 2021 .project Initial commit Aug 21, 2021 LICENSE Initial commit Aug 21, 2021 README.md Features list updated Aug 21, 2021 THIRD-PARTY.txt Initial commit Aug 21, 2021 build-DeepfakeHTTP.xml Initial commit Aug 21, 2021 image.png Initial commit Aug 21, 2021 View code [ ] DeepfakeHTTP - Your 100% static dynamic backend How it works Try DeepfakeHTTP Dump example Features Prerequisites Command Line Interface (CLI) Optional response headers (will not be sent to clients) Download License APPENDIX Dump examples Example 1. Example 2. Example 3. README.md DeepfakeHTTP - Your 100% static dynamic backend License MIT Version 1.0.2 Powered by Tommy DeepfakeHTTP is an HTTP server that uses HTTP dumps as a source for responses. Use it for: [image] * Creating the product POC or demo before even starting out with the backend * REST, GraphQL, and other APIs prototyping and testing * Hiding critical enterprise infrastructure behind simple static facade * Hacking and fine-tuning HTTP communications on both server and client sides How it works 1. Got client request 2. Search dump entries (request-response pairs) for appropriate entry by matching all specified request entry parts: method, path, headers, body 3. If entry is found, the server sends corresponded response to the client 4. If entry is not found, server search dump entries for response with status 400 (Bad request). 5. If found, send it to the client 6. If not found, sends status 400 with no body. That's all. Try DeepfakeHTTP 1. Copy the content of the dump example to the file MyDump.txt 2. Start the DeepfakeHTTP server from command line: java -jar df.jar MyDump.txt 3. Use a browser to check whether DeepfakeHTTP is running on URL http://localhost:8080/form.html Dump example # Comments are welcome! :) # Fake HTML file :) GET /form.html HTTP/1.1 HTTP/1.1 200 OK




# Fake PHP file :) POST /add_user.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded HTTP/1.1 200 OK Content-Type: text/html X-Body-Type: text/template

Hello, ${fname[0]} ${lname[0]}!

For more examples see here. Features * No dependencies * No installation * No configuration files * Single-file executable * Fully asynchronous * ETag optimization ... also supports: * All HTTP methods * Multi-line and multi-value headers * Wildcards ( * and ? with escape / ) in request path and header values * Templates in response body * Response body fetching from external sources like URLs, local files, and data URI * Per entry user-defined request and response delays (lags) Prerequisites * Java 15 or above Command Line Interface (CLI) java -jar df.jar [options] [dump1.txt] [dump2.txt] ... Options: --help print help message --port TCP port number, default: 8080 --no-listen disable listening on dump(s) changes --no-etag disable ETag optimization Optional response headers (will not be sent to clients) Header Description X-Body-Type Tells the server what the content type (media type) of the returned content actually is. Value of this header has same rules as value of standard HTTP Content-Type header. This header is useful when you want to use template or binary data as a response body. Examples: # Response body is a character data. # No 'X-Body-Type' header needed. HTTP/1.1 200 OK Content-Type: application/json {"id": 5, "name": "John Doe"} # Get response body from remote server # Body type is 'text/uri-list' (See: RFC 2483) HTTP/1.1 200 OK Content-Type: application/json X-Body-Type: text/uri-list http://example.com/api/car/1234 # Get response body from file: # Body type is 'text/uri-list' (See: RFC 2483) HTTP/1.1 200 OK Content-Type: image/jpeg X-Body-Type: text/uri-list file:///home/john/photo.jpeg # Get response body from data URI: # Body type is 'text/uri-list' (See: RFC 2483) HTTP/1.1 200 OK Content-Type: image/gif X-Body-Type: text/uri-list data:image/gif;base64,R0lGODlhAQABAIAAAP... # Get response body from template # Body type is 'text/template'. Useful for forms processing. HTTP/1.1 200 OK Content-Type: text/html X-Body-Type: text/template

Hello, ${fname[0]} ${lname[0]}!

X-Request-Delay Request delay (in milliseconds). Example: # Two seconds request delay. HTTP/1.1 200 OK X-Request-Delay: 2000 {"id": 5, "name": "John Doe"} X-Response-Delay Response delay (in milliseconds). Example: # Two seconds response delay. HTTP/1.1 200 OK X-Response-Delay: 2000 {"id": 5, "name": "John Doe"} Download Latest release: df-1.0.2.jar License The DeepfakeHTTP is released under MIT license. APPENDIX Dump examples Example 1. # Comments are welcome! :) # Please don't miss a single carriage return between headers and body! # # First request-response entry # # Client request GET /api/customer/5 HTTP/1.1 Accept-Language: ru;* # Server response HTTP/1.1 200 OK Content-Type: application/json { "id": 5, "name": "Dzhon Dou" } # # Second request-response entry # # Client request GET /api/customer/5 HTTP/1.1 # Server response HTTP/1.1 200 OK Content-Type: application/json { "id": 5, "name": "John Doe" } Example 2. # # Work with HTML forms (1) # GET /form.html HTTP/1.1 HTTP/1.1 200 OK




POST /action_page.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded HTTP/1.1 200 OK Content-Type: text/html X-Body-Type: text/template

Hello, ${fname[0]} ${lname[0]}!

Example 3. # # Work with HTML forms (2) # GET /form.html HTTP/1.1 HTTP/1.1 200 OK




Only first name 'John' and last name 'Doe' are supported.
Expected output is: Hello, John Doe!,
or HTTP status 400 Bad request if first name is not 'John' or last name is not 'Doe'.



POST /action_page.php HTTP/1.1 Content-Type: application/x-www-form-urlencoded fname=John&lname=Doe HTTP/1.1 200 OK Content-Type: text/html X-Body-Type: text/template

Hello, ${fname[0]} ${lname[0]}!

About DeepfakeHTTP is an HTTP server that uses HTTP dumps as a source for responses. xnbox.github.io/deepfakehttp#readme Topics testing api graphql rest rest-api test-automation tomcat http-server dump testing-tools dummy restful-api tommy Resources Readme License MIT License Releases 1 v1.0.2 Latest Aug 21, 2021 Languages * Java 100.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.