code-reviews

athomasoriginal 2020-11-25T01:10:07.071100Z

I have a sample of two possible directions for an HTTP Client API https://gist.github.com/athomasoriginal/bfcb1e6e9e9bc9d318725a6e7d9315b8 - anyone have a preference and what’s your thought process? :thinking_face:

phronmophobic 2020-11-25T01:17:35.071300Z

this might be a good question for #architecture. I personally might prefer option #2, with the caveat that if the first argument is a string, treat it as a url. additionally, I wouldn't have an :opts key, I would just have whatever keys that would be pass as part of :opts be part of the map passed in.

phronmophobic 2020-11-25T01:20:11.071600Z

although V1 is pretty alright too.

phronmophobic 2020-11-25T01:21:45.071800Z

I do like the fact that you can build a map that represents the full request rather than having a url + options as separate pieces that represent a request. it makes request "building" easier

athomasoriginal 2020-11-25T01:31:54.072Z

@smith.adriane Architecture! That’s the channel I was looking for 😜

😁 1
athomasoriginal 2020-11-25T01:34:30.072300Z

> might prefer option #2, with the caveat that if the first argument is a string I had the same thought as I was typing it out. I was also toying with the idea of being able to call the same get function as

(-> (get "url" opts) (.then) (.catch))

;; or

(get {...})
With the idea being we check if the first arg is a string which would make it user’s choice, but I was then worried maybe it’s overcomplicating things

athomasoriginal 2020-11-25T01:35:09.072500Z

> I wouldn’t have an `:opts` key Also agree that I might want to flatten it out