From df646a5ccfdd2427b6a7f69943e4a8aeffb58c07 Mon Sep 17 00:00:00 2001 From: sneak Date: Mon, 20 May 2024 04:01:01 -0700 Subject: [PATCH] intermediate --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 2068d57..319c8c9 100644 --- a/main.go +++ b/main.go @@ -60,6 +60,9 @@ func main() { // URL encode the JSON data urlEncodedInput := url.QueryEscape(string(jsonData)) + // Print the URL-encoded JSON input for comparison + fmt.Fprintln(os.Stderr, "URL-encoded JSON input:", urlEncodedInput) + // Construct the full URL apiURL := fmt.Sprintf("https://curiosa.io/api/trpc/card.search,card.count?batch=1&input=%s", urlEncodedInput) @@ -108,7 +111,7 @@ func setHeaders(req *http.Request) { req.Header.Set("Accept-Language", "en-US,en;q=0.5") req.Header.Set("Accept-Encoding", "gzip, deflate") req.Header.Set("Referer", "https://curiosa.io/cards") - req.Header.Set("Content-Type", "application/json") + req.Header.Set("content-type", "application/json") // Match exact casing as bash script req.Header.Set("x-build-id", "a68dd8c6f6e3b605951c534ad22e788557cabd0d") req.Header.Set("x-trpc-source", "nextjs-react") req.Header.Set("DNT", "1") @@ -126,3 +129,4 @@ func logErrorAndExit(err error) { fmt.Fprintln(os.Stderr, err) os.Exit(1) } +