Skip to content

Commit

Permalink
Remove unnecessary var annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Mar 6, 2020
1 parent ede909b commit 4dc010e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/pure/httpclient.nim
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ type
name, content: string
case isFile: bool
of true:
fileName, contentType: string
filename, contentType: string
fileSize: int64
isStream: bool
else: discard
Expand Down Expand Up @@ -306,7 +306,7 @@ proc newProxy*(url: string, auth = ""): Proxy =

proc newMultipartData*: MultipartData =
## Constructs a new ``MultipartData`` object.
MultipartData(content: @[])
MultipartData()

proc `$`*(data: MultipartData): string {.since: (1, 1).} =
## convert MultipartData to string so it's human readable when echo
Expand All @@ -318,7 +318,7 @@ proc `$`*(data: MultipartData): string {.since: (1, 1).} =
result &= " ------------------------------\n"
result &= entry.name & "\n\n" & entry.content & "\n"

proc add*(p: var MultipartData, name, content: string, filename: string = "",
proc add*(p: MultipartData, name, content: string, filename: string = "",
contentType: string = "", stream = true) =
## Add a value to the multipart data. Raises a `ValueError` exception if
## `name`, `filename` or `contentType` contain newline characters.
Expand All @@ -342,7 +342,7 @@ proc add*(p: var MultipartData, name, content: string, filename: string = "",

p.content.add(entry)

proc add*(p: var MultipartData, xs: MultipartEntries): MultipartData
proc add*(p: MultipartData, xs: MultipartEntries): MultipartData
{.discardable.} =
## Add a list of multipart entries to the multipart data `p`. All values are
## added without a filename and without a content type.
Expand All @@ -363,7 +363,7 @@ proc newMultipartData*(xs: MultipartEntries): MultipartData =
for entry in xs:
result.add(entry.name, entry.content)

proc addFiles*(p: var MultipartData, xs: openArray[tuple[name, file: string]],
proc addFiles*(p: MultipartData, xs: openArray[tuple[name, file: string]],
mimeDb = newMimetypes(), stream = true):
MultipartData {.discardable.} =
## Add files to a multipart data object. The file will be opened from your
Expand All @@ -382,15 +382,15 @@ proc addFiles*(p: var MultipartData, xs: openArray[tuple[name, file: string]],
p.add(name, content, fName & ext, contentType, stream=stream)
result = p

proc `[]=`*(p: var MultipartData, name, content: string) =
proc `[]=`*(p: MultipartData, name, content: string) =
## Add a multipart entry to the multipart data `p`. The value is added
## without a filename and without a content type.
##
## .. code-block:: Nim
## data["username"] = "NimUser"
p.add(name, content)

proc `[]=`*(p: var MultipartData, name: string,
proc `[]=`*(p: MultipartData, name: string,
file: tuple[name, contentType, content: string]) =
## Add a file to the multipart data `p`, specifying filename, contentType and
## content manually.
Expand Down

0 comments on commit 4dc010e

Please sign in to comment.