Fork me on GitHub
#re-frame
<
2023-04-02
>
Ben Lieberman00:04:30

I'm having a weird issue I think I've isolated to re-frame.http-fx. I have an endpoint returning data when I access it in the browser or from curl. I can also get the expected result from using GET in cljs-ajax alone. That request looks like so

(GET ""
  :params {"game_date_lt" "2022-05-01"
           "game_date_gt" "2022-05-01"}
  :handler (fn [resp] (.log js/console (str resp)))
  :error-handler (fn [err] (.log js/console (str err))))
But when I use reg-event-fx like this
(reg-event-fx
 ::get-statcast-data
 (fn [_ _]
   {:http-xhrio {:method :get
                 :url ""
                 :timeout 8000 
                 :response-format (ajax/json-response-format {:keywords? true})
                 :on-success [:success-http]
                 :on-failure [:failure-http]}}))
I get a 500 from the server and a NullPointerException. I know I shouldn't be passing the query string like that but if I use the :params keyword I get re-find must match on a string in the console.

Ben Lieberman00:04:06

oh boy, nvm, I can't spell... :face_palm::skin-tone-2:

p-himik07:04:24

BTW there's nothing wrong in passing parameters like that if they're static and encoded.