Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Option[int] instead of Option[string] for contentLength #16

Merged
merged 2 commits into from
Nov 21, 2022

Conversation

ire4ever1190
Copy link
Contributor

Tested with this and it all seems to work properly

import options, asyncdispatch

import src/httpx

proc onRequest(req: Request): Future[void] =
  if req.httpMethod == some(HttpGet):
    case req.path.get()
    of "/":
      req.send("Hello World")
    of "/customLength":
      req.send(Http200, "Test", contentLength = some 10)
    else:
      req.send(Http404)

run(onRequest)

Has an overload for using Option[string] so old code isn't broken but is marked deprecated so people use the newer version

@ringabout
Copy link
Owner

Thank you!

@ringabout ringabout merged commit 6f03b2d into ringabout:master Nov 21, 2022
@ire4ever1190 ire4ever1190 deleted the int-content-length branch November 21, 2022 18:34
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