webfakes::httpbin_app() API

- HTTP methods
  - getGET request
  - delDELETE request
  - patchPATCH request
  - postPOST request
  - putPUT request
- Auth
  - getBasic authentication.
  - getHidden basic authentication.
  - getDigest authentication.
  - getDigest authentication algorithms.
  - getDigest authentication, stale after.
  - getBearer authentication.
- Status codes
  - delReturn the specified HTTP status code, works for all HTTP verbs.
  - getReturn the specified HTTP status code, works for all HTTP verbs.
  - patchReturn the specified HTTP status code, works for all HTTP verbs.
  - postReturn the specified HTTP status code, works for all HTTP verbs.
  - putReturn the specified HTTP status code, works for all HTTP verbs.
- Request inspection
  - getHTTP request headers.
  - getIP address of the client.
  - getThe client's user agent.
- Response inspection
  - getCaching
  - getCache control.
  - getWork with ETags.
  - getSet response headers.
  - postSet response headers.
- Response formats
  - getA simple page that is denied for robots.
  - getSend gzip encoded data.
  - getDeflated data.
  - getbrotli compression
  - getSend UTF-8 enconded data.
  - getSend an HTML page.
  - getSend a JSON document.
  - getSend example `robots.txt` rules.
  - getSend an XML document.
- Dynamic data
  - getBase64 decoder
  - getRandom bytes.
  - getDelayed response.
  - getDrip bytes
  - getLinks
  - getStream JSON chunks.
  - getStream in chunks.
  - getRange requests.
  - headRange requests..
  - getRandom UUID.
- Cookies
  - getCookie data.
  - getDelete cookies.
  - getSet cookies.
  - getSet one cookie.
- Images
  - getReturn an image.
  - getReturn an image of the specified format.
- Redirects
  - getRedirect to an absolute URL, n times.
  - getRedirect to a relative URL, n times.
  - delRedirect to an URL.
  - getRedirect to an URL.
  - patchRedirect to an URL.
  - postRedirect to an URL.
  - putRedirect to an URL.
- Anything
  - delReturns anything passed in request data.
  - getReturns anything passed in request data.
  - patchReturns anything passed in request data.
  - postReturns anything passed in request data.
  - putReturns anything passed in request data.

API docs by Redocly

# webfakes::httpbin_app() API (1.0.0)

Download OpenAPI specification:Download

E-mail: csardi.gabor@gmail.com License: The MIT License

This is a webfakes web app for HTTP testing in R packages. It implements the https://httpbin.org API

# HTTP methods

## GET request

An endpoint to make a GET request agains. It returns the request's parameters and the request headers, in JSON.

### Responses

/get

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "headers": { },
- "origin": "string",
- "path": "string",
- "url": "string"

}`

## DELETE request

Endpoint to make DELETE requests againts.

### Responses

/delete

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## PATCH request

Endpoint to make PATCH requests against.

### Responses

/patch

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## POST request

Endpoints to make a POST request against.

### Responses

/post

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## PUT request

Endpoints to make a PUT request against.

### Responses

/put

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

# Auth

## Basic authentication.

Basic authentication with specified user and password

##### path Parameters

user required | string User name.
password required | string Password.

##### header Parameters

Authorization | string Base64 encoded user name and password. See https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side for the protocol.

### Responses

/basic-auth/:user/:password

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "user": "Aladdin"

}`

## Hidden basic authentication.

Basic authentication with specified user and password. This is the same as `/basic-auth`, but it returns a 404 if no authentication is supplied or the authentication fails.

##### path Parameters

user required | string User name.
password required | string Password.

##### header Parameters

Authorization | string Base64 encoded user name and password. See https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side for the protocol.

### Responses

/hidden-basic-auth/:user/:password

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "user": "Aladdin"

}`

## Digest authentication.

Digest authentication with specified user and password

##### path Parameters

qop required | string Quality of protection, possible values are `auth` and `auth-int`.
user required | string User name.
passwd required | string Password.

##### query Parameters

require_cookie | any Whether to require cookie handling for a successful authentication. Set to `1`, 't`or`true` to require cookies.

##### header Parameters

Authorization | string Digest authentication header. See https://en.wikipedia.org/wiki/Digest_access_authentication for the details.

### Responses

/digest-auth/:qop/:user/:passwd

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "user": "Aladdin"

}`

## Digest authentication algorithms.

Digest authentication with specified user and password, and algorithm.

##### path Parameters

qop required | string Quality of protection, possible values are `auth` and `auth-int`.
user required | string User name.
passwd required | string Password.
algorithm required | string Hashing algorithm to use: `MD5`, `SHA-256` or `SHA-512`.

##### query Parameters

require_cookie | any Whether to require cookie handling for a successful authentication. Set to `1`, 't`or`true` to require cookies.

##### header Parameters

Authorization | string Digest authentication header. See https://en.wikipedia.org/wiki/Digest_access_authentication for the details.

### Responses

/digest-auth/:qop/:user/:passwd/:algorithm

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "user": "Aladdin"

}`

## Digest authentication, stale after.

Digest authentication with specified user, password and algorithm, with a stale_after value.

##### path Parameters

qop required | string Quality of protection, possible values are `auth` and `auth-int`.
user required | string User name.
passwd required | string Password.
algorithm required | string Hashing algorithm to use: `MD5`, `SHA-256` or `SHA-512`.
stale_after required | string How many requests are allowed. This is stored in a cookie.

##### query Parameters

require_cookie | any Whether to require cookie handling for a successful authentication. Set to `1`, 't`or`true` to require cookies.

##### header Parameters

Authorization | string Digest authentication header. See https://en.wikipedia.org/wiki/Digest_access_authentication for the details.

### Responses

/digest-auth/:qop/:user/:passwd/:algorithm/:stale_after

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "user": "Aladdin"

}`

## Bearer authentication.

Checks is that a token is supplied in the `Authorization` header.

##### header Parameters

Authorization | string^Bearer

### Responses

/bearer

### Response samples

- 200

Content type
application/json
`
{

- "authenticated": true,
- "token": "string"

}`

# Status codes

## Return the specified HTTP status code, works for all HTTP verbs.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more about status codes.

##### path Parameters

status required | integer Status code.

### Responses

/status/:status

## Return the specified HTTP status code, works for all HTTP verbs.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more about status codes.

##### path Parameters

status required | integer Status code.

### Responses

/status/:status

## Return the specified HTTP status code, works for all HTTP verbs.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more about status codes.

##### path Parameters

status required | integer Status code.

### Responses

/status/:status

## Return the specified HTTP status code, works for all HTTP verbs.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more about status codes.

##### path Parameters

status required | integer Status code.

### Responses

/status/:status

## Return the specified HTTP status code, works for all HTTP verbs.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`. See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes for more about status codes.

##### path Parameters

status required | integer Status code.

### Responses

/status/:status

# Request inspection

## HTTP request headers.

### Responses

/headers

### Response samples

- 200

Content type
application/json
`
{

- "headers": { }

}`

## IP address of the client.

### Responses

/ip

### Response samples

- 200

Content type
application/json
`
{

- "origin": "string"

}`

## The client's user agent.

### Responses

/user-agent

### Response samples

- 200

Content type
application/json
`
{

- "user-agent": "string"

}`

# Response inspection

## Caching

Returns a 304 if an `If-Modified-Since` header or `If-None-Match` is present. Returns the same as a GET otherwise.

##### header Parameters

If-Modified-Since | any
If-None-Match | any

### Responses

/cache

## Cache control.

Sets a `Cache-Control` header for n seconds.

##### path Parameters

value | integer

### Responses

/cache/:value

## Work with ETags.

Assumes the specified `etag` parameter as the `ETag` header.

- If a matching tag is supplied in the `If-None-Match` header, then it returns with HTTP status code 304.
- If a non-matching `If-Match` header is supplied, then it return with HTTP status code 412.
- Otherwise it returns with a JSON body and status 200.

See https://en.wikipedia.org/wiki/HTTP_ETag for more about `ETag` headers.

##### path Parameters

etag required | string Assumed ETag value.

### Responses

/etag/:etag

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "headers": { },
- "origin": "string",
- "path": "string",
- "url": "string"

}`

## Set response headers.

Set response headers from the passed query parameters. The same parameter migth be specified multiple times to create the same HTTP header multiple times.

##### query Parameters

| object

### Responses

/response-headers

### Response samples

- 200

Content type
application/json
`{ }`

## Set response headers.

Set response headers from the passed query parameters. The same parameter migth be specified multiple times to create the same HTTP header multiple times.

##### query Parameters

| object

### Responses

/response-headers

### Response samples

- 200

Content type
application/json
`{ }`

# Response formats

## A simple page that is denied for robots.

This exists in conjunction with `/robots.txt` which disallows this page.

### Responses

/deny

## Send gzip encoded data.

### Responses

/gzip

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Deflated data.

Returns Deflate-encoded data. This needs the zip R package.

/deflate

## brotli compression

Returns brotli-encoded data. This needs the brotli R package.

/brotli

## Send UTF-8 enconded data.

### Responses

/encoding/utf8

## Send an HTML page.

### Responses

/html

## Send a JSON document.

### Responses

/json

### Response samples

- 200

Content type
application/json
`{ }`

## Send example `robots.txt` rules.

It will not allow the `/deny` endpoint.

### Responses

/robots.txt

## Send an XML document.

### Responses

/xml

# Dynamic data

## Base64 decoder

Base64 decode the supplied value and echo it back.

##### path Parameters

value required | string Assumed ETag value.

### Responses

/base64/:value

## Random bytes.

##### path Parameters

n required | integer Number of bytes, maximum 10000.

### Responses

/bytes/:n

## Delayed response.

Wait for the specified number of seconds before sending the response.

##### path Parameters

secs required | number Number of seconds, fractions are supported.

### Responses

/delay/:secs

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Drip bytes

Drip the specified number of bytes over the specified number of seconds, potentially after some initial delay.

##### query Parameters

duration | number Default: 2 Number of seconds for the whole response.
numbytes | integer Default: 10 Number of bytes to return.
code | integer Default: 200 HTTP status code to return with.
delay | number Default: 0 Initial delay, in seconds. Zero means no delay.

### Responses

/drip

## Links

Generate a page containing n links to other pages which do the same.

##### path Parameters

n required | integer Number of links.
offset | integer Id of the page to return, out of `n`.

### Responses

/links/:n/:offset

## Stream JSON chunks.

Stream `n` JSON responses, each terminated by a newline character.

##### path Parameters

n required | integer Number of JSON chunks to send.

### Responses

/stream/:n

## Stream in chunks.

Streams n random bytes generated with given seed, at given chunk size per packet.

##### path Parameters

n required | integer Number of bytes, maximum 102400.

##### query Parameters

seed | number Default: 42 Random seed.
chunk-size | integer Default: 10240 Size of a chunked for the chunked encoding. The last chunk migh be shorter than his.

### Responses

/stream-bytes/:n

## Range requests.

Send only part of the response, after a `Range` header.

##### path Parameters

n required | integer Number of bytes, maximum 102400.

##### query Parameters

chunk_size | number Default: 10240 Chunk size, if `duration` is not 0.
duration | number Default: 0 Duration for the total response. It applies to the full response size without ranges.

### Responses

/range/:n

## Range requests..

##### path Parameters

n required | integer Number of bytes, maximum 102400.

##### query Parameters

chunk_size | number Default: 10240 Chunk size, if `duration` is not 0.
duration | number Default: 0 Duration for the total response. It applies to the full response size without ranges.

### Responses

/range/:n

## Random UUID.

It is pseudo-random, and not secure.

### Responses

/uuid

### Response samples

- 200

Content type
application/json
`
{

- "uuid": "ee4610df-3b7b-4624-8ce9-da6975b3e9f1"

}`

# Cookies

## Cookie data.

Returns cookie data.

### Responses

/cookies

### Response samples

- 200

Content type
application/json
`
{

- "cookies": { }

}`

## Delete cookies.

Deletes cookie(s) as provided by the query string and redirects to cookie list.

##### query Parameters

freeform | any

### Responses

/cookies/delete

## Set cookies.

Sets cookie(s) as provided by the query string and redirects to cookie list.

##### query Parameters

freeform | any

### Responses

/cookies/set

## Set one cookie.

Sets a cookie and redirects to cookie list.

##### path Parameters

name | string Cookie name.
value | string Cookie value.

### Responses

/cookies/set/:name/:value

# Images

## Return an image.

It selects the format according to the `Accept` request header. Supported formats: `image/jpeg`, `image/png`, `image/svg+xml`, `image/webp`, `image/*`.

##### header Parameters

Accept | string Accepted image content type.

### Responses

/image

### Response samples

- 406

Content type
application/json
`
{

- "message": "Client did not request a supported media type.",
- "accept":
  [
  - "image/jpeg",
  - "image/png",
  - "image/svg+xml",
  - "image/webp"
  ]

}`

## Return an image of the specified format.

##### path Parameters

format required | string Image format. May be `jpeg`, `png`, `svg` or `webp`.

### Responses

/image/:format

# Redirects

## Redirect to an absolute URL, n times.

##### path Parameters

n required | integer Number of times to redirect. Maximum is five.

### Responses

/absolute-redirect/:n

## Redirect to a relative URL, n times.

##### path Parameters

n required | integer Number of times to redirect. Maximum is five.

### Responses

/relative-redirect/:n

## Redirect to an URL.

See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection for details. This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

##### query Parameters

url | string URL to redirect to.
status_code | integer Default: 302 HTTP status code to use for the redirection.

### Responses

/redirect-to

## Redirect to an URL.

See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection for details. This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

##### query Parameters

url | string URL to redirect to.
status_code | integer Default: 302 HTTP status code to use for the redirection.

### Responses

/redirect-to

## Redirect to an URL.

See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection for details. This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

##### query Parameters

url | string URL to redirect to.
status_code | integer Default: 302 HTTP status code to use for the redirection.

### Responses

/redirect-to

## Redirect to an URL.

See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection for details. This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

##### query Parameters

url | string URL to redirect to.
status_code | integer Default: 302 HTTP status code to use for the redirection.

### Responses

/redirect-to

## Redirect to an URL.

See https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection for details. This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

##### query Parameters

url | string URL to redirect to.
status_code | integer Default: 302 HTTP status code to use for the redirection.

### Responses

/redirect-to

# Anything

## Returns anything passed in request data.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

### Responses

/anything

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Returns anything passed in request data.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

### Responses

/anything

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Returns anything passed in request data.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

### Responses

/anything

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Returns anything passed in request data.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

### Responses

/anything

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`

## Returns anything passed in request data.

This endpoint works for these other HTTP verbs as well, the same way as for `GET`: `CONNECT`, `DELETE`, `HEAD`, `MKCOL`, `OPTIONS`, `PATCH`, `POST`, `PROPFIND`, `PUT`, `REPORT`.

### Responses

/anything

### Response samples

- 200

Content type
application/json
`
{

- "args": { },
- "data": { },
- "files": { },
- "form": { },
- "headers": { },
- "json": { },
- "method": "string",
- "path": "string",
- "origin": "string",
- "url": "string"

}`