From 2e57ddb4552c5deb459d9e30e67333f3261a00ba Mon Sep 17 00:00:00 2001 From: cheatfate Date: Thu, 21 Oct 2021 14:01:46 +0300 Subject: [PATCH] Fix preferredContentType() function declaration to avoid confusion with `preferredContentType(varargs)`. --- chronos/apps/http/httpserver.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chronos/apps/http/httpserver.nim b/chronos/apps/http/httpserver.nim index 96abe1fab..cce74b6aa 100644 --- a/chronos/apps/http/httpserver.nim +++ b/chronos/apps/http/httpserver.nim @@ -485,7 +485,7 @@ proc preferredContentMediaType*(acceptHeader: string): MediaType = MediaType.init("*", "*") proc preferredContentType*(acceptHeader: string, - types: varargs[string]): Result[string, cstring] = + types: openArray[string] = []): Result[string, cstring] = ## Match or obtain preferred content-type using ``Accept`` header specified by ## string ``acceptHeader``. ## @@ -519,8 +519,8 @@ proc preferredContentType*(acceptHeader: string, # If `Accept` header is missing, client accepts any type of content. ok(types[0]) else: - let res = getAcceptInfo(acceptHeader) - if res.isErr(): + let ares = getAcceptInfo(acceptHeader) + if ares.isErr(): # If `Accept` header is incorrect, client accepts any type of content. ok(types[0]) else: @@ -530,7 +530,7 @@ proc preferredContentType*(acceptHeader: string, for item in types: res.add(MediaType.init(item)) res - for item in res.get().data: + for item in ares.get().data: for expect in mediaTypes: if expect == item.mediaType: return ok($expect)