From 6875569bf2122623132cf58a42e75affda4a957c Mon Sep 17 00:00:00 2001 From: PrivacyDev Date: Sun, 9 Apr 2023 17:32:57 -0400 Subject: [PATCH] stopped using Twitter session info for userID requests --- src/apiutils.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/apiutils.nim b/src/apiutils.nim index 15c7200..e45954c 100644 --- a/src/apiutils.nim +++ b/src/apiutils.nim @@ -43,10 +43,6 @@ proc genHeaders*(token: Token = nil): HttpHeaders = "accept": "*/*", "DNT": "1" }) - if len(cfg.cookieHeader) != 0: - result.add("Cookie", cfg.cookieHeader) - if len(cfg.xCsrfToken) != 0: - result.add("x-csrf-token", cfg.xCsrfToken) template updateToken() = if api != Api.search and resp.headers.hasKey(rlRemaining): @@ -105,6 +101,12 @@ template fetchImpl(result, additional_headers, fetchBody) {.dirty.} = raise rateLimitError() proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders()): Future[JsonNode] {.async.} = + + if len(cfg.cookieHeader) != 0: + additional_headers.add("Cookie", cfg.cookieHeader) + if len(cfg.xCsrfToken) != 0: + additional_headers.add("x-csrf-token", cfg.xCsrfToken) + var body: string fetchImpl(body, additional_headers): if body.startsWith('{') or body.startsWith('['):