Skip to content

Document Response and Request constructors#644

Merged
quinnj merged 1 commit intoJuliaWeb:masterfrom
rikhuijzer:master
Dec 12, 2020
Merged

Document Response and Request constructors#644
quinnj merged 1 commit intoJuliaWeb:masterfrom
rikhuijzer:master

Conversation

@rikhuijzer
Copy link
Copy Markdown
Contributor

The documentation for using HTTP.Response and HTTP.Request wasn't very clear in the REPL. This PR changes the documentation for HTTP.Response from

help?> HTTP.Response
  Response <: Message

  Represents a HTTP Response Message.

    •    version::VersionNumber RFC7230 2.6 (https://tools.ietf.org/html/rfc7230#section-2.6)

    •    status::Int16 RFC7230 3.1.2 (https://tools.ietf.org/html/rfc7230#section-3.1.2) RFC7231 6
        (https://tools.ietf.org/html/rfc7231#section-6)

    •    headers::Vector{Pair{String,String}} RFC7230 3.2
        (https://tools.ietf.org/html/rfc7230#section-3.2)

    •    body::Vector{UInt8} RFC7230 3.3 (https://tools.ietf.org/html/rfc7230#section-3.3)

    •    request, the Request that yielded this Response.

to

help?> HTTP.Response
  Response <: Message

  Represents a HTTP Response Message.

    •    version::VersionNumber RFC7230 2.6 (https://tools.ietf.org/html/rfc7230#section-2.6)

    •    status::Int16 RFC7230 3.1.2 (https://tools.ietf.org/html/rfc7230#section-3.1.2) RFC7231 6
        (https://tools.ietf.org/html/rfc7231#section-6)

    •    headers::Vector{Pair{String,String}} RFC7230 3.2
        (https://tools.ietf.org/html/rfc7230#section-3.2)

    •    body::Vector{UInt8} RFC7230 3.3 (https://tools.ietf.org/html/rfc7230#section-3.3)

    •    request, the Request that yielded this Response.

  ─────────────────────────────────────────────────────────────────────────────────────────────────────

  Response(status::Int, headers=[]; body=UInt8[], request=nothing) -> HTTP.Response

  ─────────────────────────────────────────────────────────────────────────────────────────────────────

  HTTP.Response(status::Int, body) -> HTTP.Response

  Examples
  ==========

  HTTP.Response(200, "Hello")

  headers = ["Server" => "Apache"]
  HTTP.Response(200, headers; body = "Hello")

and changes the documentation from HTTP.Request from

help?> HTTP.Request
  Request <: Message

  Represents a HTTP Request Message.

    •    method::String RFC7230 3.1.1 (https://tools.ietf.org/html/rfc7230#section-3.1.1)

    •    target::String RFC7230 5.3 (https://tools.ietf.org/html/rfc7230#section-5.3)

    •    version::VersionNumber RFC7230 2.6 (https://tools.ietf.org/html/rfc7230#section-2.6)

    •    headers::Vector{Pair{String,String}} RFC7230 3.2
        (https://tools.ietf.org/html/rfc7230#section-3.2)

    •    body::Vector{UInt8} RFC7230 3.3 (https://tools.ietf.org/html/rfc7230#section-3.3)

    •    response, the Response to this Request

    •    txcount, number of times this Request has been sent (see RetryRequest.jl).

    •    parent, the Response (if any) that led to this request (e.g. in the case of a redirect).
        RFC7230 6.4 (https://tools.ietf.org/html/rfc7231#section-6.4)

to

help?> HTTP.Request
  Request <: Message

  Represents a HTTP Request Message.

    •    method::String RFC7230 3.1.1 (https://tools.ietf.org/html/rfc7230#section-3.1.1)

    •    target::String RFC7230 5.3 (https://tools.ietf.org/html/rfc7230#section-5.3)

    •    version::VersionNumber RFC7230 2.6 (https://tools.ietf.org/html/rfc7230#section-2.6)

    •    headers::Vector{Pair{String,String}} RFC7230 3.2
        (https://tools.ietf.org/html/rfc7230#section-3.2)

    •    body::Vector{UInt8} RFC7230 3.3 (https://tools.ietf.org/html/rfc7230#section-3.3)

    •    response, the Response to this Request

    •    txcount, number of times this Request has been sent (see RetryRequest.jl).

    •    parent, the Response (if any) that led to this request (e.g. in the case of a redirect).
        RFC7230 6.4 (https://tools.ietf.org/html/rfc7231#section-6.4)

  ─────────────────────────────────────────────────────────────────────────────────────────────────────

  HTTP.Request(method, target, headers, body; version, parent) -> HTTP.Request

  Constructor for HTTP.Request. For daily use, see HTTP.request.

Copy link
Copy Markdown
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@quinnj quinnj merged commit edc5e28 into JuliaWeb:master Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants