Skip to content

Commit

Permalink
Converts func to proc where appropriate (#30)
Browse files Browse the repository at this point in the history
These procs access IO and so can't really be considered functions. `strictFuncs` also complains about them so they need to be changed so other libraries can work with `strictFuncs`
  • Loading branch information
ire4ever1190 authored Jun 26, 2023
1 parent a3a2a9f commit cce9afe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/httpx.nim
Original file line number Diff line number Diff line change
Expand Up @@ -573,23 +573,23 @@ proc eventLoop(params: (OnRequest, Settings, ThreadVars)) =
if threadVars.event.isSome():
threadVars.event.get().trigger()

func httpMethod*(req: Request): Option[HttpMethod] {.inline.} =
proc httpMethod*(req: Request): Option[HttpMethod] {.inline.} =
## Parses the request's data to find the request HttpMethod.
parseHttpMethod(req.selector.getData(req.client).data)

func path*(req: Request): Option[string] {.inline.} =
proc path*(req: Request): Option[string] {.inline.} =
## Parses the request's data to find the request target.
if unlikely(req.client notin req.selector):
return
parsePath(req.selector.getData(req.client).data)

func headers*(req: Request): Option[HttpHeaders] =
proc headers*(req: Request): Option[HttpHeaders] =
## Parses the request's data to get the headers.
if unlikely(req.client notin req.selector):
return
parseHeaders(req.selector.getData(req.client).data)

func body*(req: Request): Option[string] =
proc body*(req: Request): Option[string] =
## Retrieves the body of the request.
let pos = req.selector.getData(req.client).headersFinishPos
if pos == -1:
Expand All @@ -604,7 +604,7 @@ func body*(req: Request): Option[string] =
0
doAssert result.get.len == length

func ip*(req: Request): string =
proc ip*(req: Request): string =
## Retrieves the IP address that the request was made from.
req.selector.getData(req.client).ip

Expand Down

0 comments on commit cce9afe

Please sign in to comment.