webfakes::httpbin_app() API (1.0.0)

Download OpenAPI specification:Download

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Content type
application/json
Copy
Expand all Collapse all
{
  • "args": { },