0

I'm trying to create a fulfillment app for shopify, and they send a call once an hour to an endpoint on my app, with the order names they need me to provide tracking numbers for.

Unfortunately the order names have "#" in them (ex. #1001.1). When I receive these calls the query arguments get cut off at the # and the rest of the query string no longer shows. When I remove the # from the call (while testing), the whole query string comes through.

With #'s

Request

GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=#1001.1&order_names[]=#1002.1&order_names[]=#1003.2

Logged Request on server side

GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=

Without #'s

Request

GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=1001.1&order_names[]=1002.1&order_names[]=1003.2

Logged Request on server side

GET http://localhost:4200/v1/fetch_tracking_numbers.json?order_names[]=1001.1&order_names[]=1002.1&order_names[]=1003.2

I'm using atreugo built on top of fasthttp.

Thanks!

  • 2
    How does the standard library http stack handle this? fasthttp is fast because of the shortcuts it takes. – Burak Serdar Nov 12 '21 at 20:52
  • 2
    See [Encode / Decode URLs](https://stackoverflow.com/q/13820280/11424673). You should always properly encode raw strings when constructing a URL. – Hymns For Disco Nov 12 '21 at 20:59
  • Ah the shortcuts makes sense. – Brady Agranoff Nov 12 '21 at 21:00
  • I'm not actually encoding the URL, I'm receiving a call from shopify. They encode it. IDK why they needed to use name instead of all the other possibly ID's to provide. – Brady Agranoff Nov 12 '21 at 21:02
  • 1
    An unencoded `#` should never be received by a server. It's used client-side as the anchor identifier, which isn't sent with the request. Any server that receives it should only receive it encoded as `%23`. It sounds like Shopify has a bug in their handler. – Adrian Nov 12 '21 at 21:02
  • Definitely could be. Here's the docs for it: – Brady Agranoff Nov 12 '21 at 21:09
  • https://shopify.dev/api/admin-rest/2021-10/resources/fulfillmentservice#top Unfortunately I need this quick lol, guess I'm gonna need a workaround – Brady Agranoff Nov 12 '21 at 21:10
  • It may help to show your code. How are you getting "Logged request on server side"? Maybe there is a way to intercept and fix the illegal encoding. – Hymns For Disco Nov 12 '21 at 21:56

1 Answers1

1

Just want to respond here with an update. I'm an idiot. Shopify encodes their request URI's.

Their docs mislead me, along with my stupidity. Thanks to everyone who tried to help!