cljs-http icon indicating copy to clipboard operation
cljs-http copied to clipboard

&android= appended to all queries on chrome for android

Open gbuisson opened this issue 11 years ago • 2 comments

if a query is issued from Chrome on an android device, every request gets an &android=<rand_int> param appended to the called url.

browsing the code i see it's a feature supposed to fix CORS on android:

(defn wrap-android-cors-bugfix [client]
  (fn [request]
    (client
     (if (util/android?)
       (assoc-in request [:query-params :android] (Math/random))
       request))))

the problem is that with strict APIS, implemented with compojure-api for instance, every useless parameter sent by the client is unallowed, thus breaking the call.

If i switch chrome to "request desktop site" on my phone browser, every http call is working normally even though we're using CORS, so maybe this piece of code is outdated ?

if possible, could you at least make it optional ? Thank you very much.

gbuisson avatar Nov 04 '14 18:11 gbuisson

Sure, PR welcome ...

r0man avatar Nov 04 '14 18:11 r0man

be my guest ;-)

gbuisson avatar Nov 05 '14 10:11 gbuisson