Skip to content

Faulty example in docs for Http.send #404

@JeremiahSecrist

Description

@JeremiahSecrist

I found an issue with an example here
I've extracted and commented the issues below

# Prints out the HTML of the Roc-lang website.
# the parser complains about the usage of || within this example
response = ||
    #  url is not valid, as in the latest version uri is the correct target.
    Http.send!({ Http.default_request & url: "https://www.roc-lang.org" })?


Str.from_utf8(response.body) ?? "Invalid UTF-8"
|> Stdout.line

Possible solution:

main! = |_args|
    response = Http.send!({ Http.default_request & uri: "https://www.roc-lang.org" })?
    Str.from_utf8(response.body) ?? "Invalid UTF-8"
    |> Stdout.line!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions