Documentation Powered by ReDoc

# 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

200

Success.

get/get
/get

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## DELETE request

Endpoint to make DELETE requests againts.

### Responses

200

Success.

delete/delete
/delete

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## PATCH request

Endpoint to make PATCH requests against.

### Responses

200

Success.

patch/patch
/patch

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## POST request

Endpoints to make a POST request against.

### Responses

200

Success.

post/post
/post

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## PUT request

Endpoints to make a PUT request against.

### Responses

200

Success.

put/put
/put

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

Success.

401

Failed authentication.

get/basic-auth/:user/:password
/basic-auth/:user/:password

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## Bearer authentication.

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

##### header Parameters

Authorization | string ^Bearer

### Responses

200

Success.

401

Failed authentication.

get/bearer
/bearer

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

100

Informational responses.

200

Success.

300

Redirection.

400

Client errors.

500

Server errors.

delete/status/:status
/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

100

Informational responses.

200

Success.

300

Redirection.

400

Client errors.

500

Server errors.

get/status/:status
/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

100

Informational responses.

200

Success.

300

Redirection.

400

Client errors.

500

Server errors.

patch/status/:status
/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

100

Informational responses.

200

Success.

300

Redirection.

400

Client errors.

500

Server errors.

post/status/:status
/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

100

Informational responses.

200

Success.

300

Redirection.

400

Client errors.

500

Server errors.

put/status/:status
/status/:status

# Request inspection

## HTTP request headers.

### Responses

200

The requests's HTTP headers.

get/headers
/headers

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "headers": { }

}`

## IP address of the client.

### Responses

200

The IP address of the client, usually `127.0.0.1`, as the webfakes server runs on the localhost.

get/ip
/ip

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "origin": "string"

}`

## The client's user agent.

### Responses

200

The content of the `User-Agent` HTTP request header.

get/user-agent
/user-agent

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "user-agent": "string"

}`

# Response inspection

## 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

200

Non-matching `If-Non-Match` or matching `If-Match`, or no such headers at all.

304

Matching `If-Non-Match` header.

412

Non-matchinf `If-Match` header.

get/etag/:etag
/etag/:etag

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

params | object

### Responses

200

The passed query parameters are also returned as a JSON response.

get/response-headers
/response-headers

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`{ }`

## 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

params | object

### Responses

200

The passed query parameters are also returned as a JSON response.

post/response-headers
/response-headers

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`{ }`

# Response formats

## A simple page that is denied for robots.

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

### Responses

200

A simple page.

get/deny
/deny

## Send gzip encoded data.

### Responses

200

Some gzipped JSON.

get/gzip
/gzip

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

## Send UTF-8 enconded data.

### Responses

200

HTML with a lot of UTF-8.

get/encoding/utf8
/encoding/utf8

## Send an HTML page.

### Responses

200

An example HTML page.

get/html
/html

## Send a JSON document.

### Responses

200

An example JSON document.

get/json
/json

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`{ }`

## Send example `robots.txt` rules.

It will not allow the `/deny` endpoint.

### Responses

200

An example `robots.txt` file.

get/robots.txt
/robots.txt

## Send an XML document.

### Responses

200

An example XML document.

get/xml
/xml

# Dynamic data

## Base64 decoder

Base64 decode the supplied value and echo it back.

##### path Parameters

value required | string Assumed ETag value.

### Responses

200

Decoded base64.

get/base64/:value
/base64/:value

## Random bytes.

##### path Parameters

n required | integer Number of bytes, maximum 10000.

### Responses

200

Random bytes.

get/bytes/:n
/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

200

JSON response.

get/delay/:secs
/delay/:secs

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

Data of the specified length. The status code is not neccesarily 200, but the one specified in the `code` query parameter.

get/drip
/drip

## 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

200

Random bytes.

get/stream-bytes
/stream-bytes

## Random UUID.

It is pseudo-random, and not secure.

### Responses

200

Random UUID v4 in JSON.

get/uuid
/uuid

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`

# 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

200

Image file.

406

The client did not request a supported media type.

get/image
/image

### Response samples

- 406

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

Image file.

get/image/:format
/image/:format

# Redirects

## Redirect to an absolute URL, n times.

##### path Parameters

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

### Responses

302

Redirect.

get/absolute-redirect/:n
/absolute-redirect/:n

## Redirect to a relative URL, n times.

##### path Parameters

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

### Responses

302

Redirect.

get/relative-redirect/:n
/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

300

Multiple Choices.

301

Moved Permanently.

302

Found (Previously "Moved temporarily")

303

See Other (since HTTP/1.1)

304

Not Modified (RFC 7232)

305

Use Proxy (since HTTP/1.1)

306

Switch Proxy

307

Temporary Redirect (since HTTP/1.1)

308

Permanent Redirect (RFC 7538)

delete/redirect-to
/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

300

Multiple Choices.

301

Moved Permanently.

302

Found (Previously "Moved temporarily")

303

See Other (since HTTP/1.1)

304

Not Modified (RFC 7232)

305

Use Proxy (since HTTP/1.1)

306

Switch Proxy

307

Temporary Redirect (since HTTP/1.1)

308

Permanent Redirect (RFC 7538)

get/redirect-to
/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

300

Multiple Choices.

301

Moved Permanently.

302

Found (Previously "Moved temporarily")

303

See Other (since HTTP/1.1)

304

Not Modified (RFC 7232)

305

Use Proxy (since HTTP/1.1)

306

Switch Proxy

307

Temporary Redirect (since HTTP/1.1)

308

Permanent Redirect (RFC 7538)

patch/redirect-to
/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

300

Multiple Choices.

301

Moved Permanently.

302

Found (Previously "Moved temporarily")

303

See Other (since HTTP/1.1)

304

Not Modified (RFC 7232)

305

Use Proxy (since HTTP/1.1)

306

Switch Proxy

307

Temporary Redirect (since HTTP/1.1)

308

Permanent Redirect (RFC 7538)

post/redirect-to
/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

300

Multiple Choices.

301

Moved Permanently.

302

Found (Previously "Moved temporarily")

303

See Other (since HTTP/1.1)

304

Not Modified (RFC 7232)

305

Use Proxy (since HTTP/1.1)

306

Switch Proxy

307

Temporary Redirect (since HTTP/1.1)

308

Permanent Redirect (RFC 7538)

put/redirect-to
/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

200

The request data.

delete/anything
/anything

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

The request data.

get/anything
/anything

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

The request data.

patch/anything
/anything

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

The request data.

post/anything
/anything

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

- "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

200

The request data.

put/anything
/anything

### Response samples

- 200

Content type
application/json
Copy
Expand all Collapse all
`
{

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

}`