Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-29 13:18:18 <lleb> + 1 aeson:
2021-04-29 13:18:19 <lleb> + 48 <flagname>: true
2021-04-29 13:18:38 <lleb> flags:
2021-04-29 13:18:38 <lleb>   aeson:
2021-04-29 13:18:39 <lleb>    <flagname>: true
2021-04-29 13:19:12 <lleb> i dont even know if my issue come from this, what is the expected behavior if i use setRequestBodyJSON without the proper flag enabled ?
2021-04-29 13:19:35 <lleb> i hope im asking this in the right place
2021-04-29 13:19:41 × pavonia quits (~user@unaffiliated/siracusa) (Quit: Bye!)
2021-04-29 13:19:49 × finn_elija quits (~finn_elij@gateway/tor-sasl/finnelija/x-67402716) (Remote host closed the connection)
2021-04-29 13:20:20 finn_elija joins (~finn_elij@gateway/tor-sasl/finnelija/x-67402716)
2021-04-29 13:22:21 × rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds)
2021-04-29 13:24:45 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Ping timeout: 240 seconds)
2021-04-29 13:24:45 × jpds quits (~jpds@gateway/tor-sasl/jpds) (Ping timeout: 240 seconds)
2021-04-29 13:24:59 × kritzefitz quits (~kritzefit@p200300ecdf3c5b009ca7d9f9eb7bbe17.dip0.t-ipconnect.de) (Ping timeout: 250 seconds)
2021-04-29 13:25:17 kritzefitz joins (~kritzefit@2003:5b:203b:200::10:49)
2021-04-29 13:25:25 × whosit quits (~whosit@109-252-94-126.nat.spd-mgts.ru) (Quit: Lost terminal)
2021-04-29 13:26:51 jpds joins (~jpds@gateway/tor-sasl/jpds)
2021-04-29 13:27:01 sord937 joins (~sord937@gateway/tor-sasl/sord937)
2021-04-29 13:27:49 chimera joins (~chimera@168-182-134-95.pool.ukrtel.net)
2021-04-29 13:30:01 __minoru__shirae joins (~shiraeesh@46.34.207.120)
2021-04-29 13:32:53 × Qwerky quits (~qwerky@37.170.132.154) (Remote host closed the connection)
2021-04-29 13:34:42 Qwerky joins (~qwerky@37.170.132.154)
2021-04-29 13:35:23 × ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection)
2021-04-29 13:35:39 slac48041 joins (~slack1256@200.112.85.255)
2021-04-29 13:36:05 ukari joins (~ukari@unaffiliated/ukari)
2021-04-29 13:36:47 × geekosaur quits (930099da@rrcs-147-0-153-218.central.biz.rr.com) (Quit: Connection closed)
2021-04-29 13:37:53 × slack1256 quits (~slack1256@181.203.33.200) (Ping timeout: 265 seconds)
2021-04-29 13:37:56 × jgt quits (~jgt@88.225.221.135) (Ping timeout: 268 seconds)
2021-04-29 13:38:00 <tomsmeding> lleb: can you check what exactly you're sending to the server, and if that's what you expect?
2021-04-29 13:38:57 <tomsmeding> lleb: also, that's not the way you set flags, I think; but in any case the 'aeson' flag is enabled by default for http-conduit, so that should be fine
2021-04-29 13:39:06 <lleb> i would love to, i have no clue of how i cant see or print the actual http request that is sent to the server tomsmeding
2021-04-29 13:39:17 <lleb> i can*
2021-04-29 13:39:49 <lleb> i see how to print a Request object, but that's style an haskell data structure and not an actual http request
2021-04-29 13:39:58 <lleb> that's still*
2021-04-29 13:41:49 geekosaur joins (930099da@rrcs-147-0-153-218.central.biz.rr.com)
2021-04-29 13:42:09 ddellacosta joins (ddellacost@gateway/vpn/mullvad/ddellacosta)
2021-04-29 13:42:32 × whatisRT quits (~whatisRT@ip5b416a33.dynamic.kabel-deutschland.de) (Ping timeout: 240 seconds)
2021-04-29 13:42:45 <lleb> im confident about what the server expect since i with a curl request i had the answer i expected, but im not aware of a tool to debug that kind of thing in haskell
2021-04-29 13:43:46 whatisRT joins (~whatisRT@ip5b416a33.dynamic.kabel-deutschland.de)
2021-04-29 13:43:49 <lleb> (im not the owner of the server so i cant print the incoming request from the server side)
2021-04-29 13:43:55 <tomsmeding> lleb: https://requestbin.com exists (make sure to click the 'public bin' link)
2021-04-29 13:44:57 hypercube joins (~hypercube@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com)
2021-04-29 13:45:12 × timCF quits (~i.tkachuk@200-149-20-81.sta.estpak.ee) (Quit: leaving)
2021-04-29 13:46:03 × Tario quits (~Tario@201.192.165.173) (Read error: Connection reset by peer)
2021-04-29 13:46:05 <lleb> tomsmeding cool, i didnt tough about that kind of solution
2021-04-29 13:46:23 Guest87676 joins (~laudiacay@67.176.215.84)
2021-04-29 13:46:26 × ddellacosta quits (ddellacost@gateway/vpn/mullvad/ddellacosta) (Ping timeout: 240 seconds)
2021-04-29 13:48:15 <tomsmeding> lleb: when something goes wrong, always look at what the data in question actually looks like :)
2021-04-29 13:48:37 <tomsmeding> instead of trying to imagine what it should be -- indeed, that's what you should then _compare_ it to
2021-04-29 13:48:51 <tomsmeding> often that produces some surprises ;)
2021-04-29 13:48:52 × Eoco quits (~ian@x-160-94-179-157.acm.umn.edu) (Ping timeout: 240 seconds)
2021-04-29 13:48:53 frozenErebus joins (~frozenEre@37.231.244.249)
2021-04-29 13:49:33 xkapastel joins (uid17782@gateway/web/irccloud.com/x-emokxuotemcxsfjh)
2021-04-29 13:49:37 <lleb> tomsmeding i compared my haskell request body and my curl request body. I added \ character in the haskell one ( { \"key\": value } ) and they are appearing in the final request body
2021-04-29 13:50:26 × Guest87676 quits (~laudiacay@67.176.215.84) (Ping timeout: 240 seconds)
2021-04-29 13:50:36 <tomsmeding> lleb: is your Content-Type header correct? Are those \ characters actually sent to the server (if so, that sounds wrong -- json doesn't need backslashes)?
2021-04-29 13:50:50 Tario joins (~Tario@garza.riseup.net)
2021-04-29 13:51:40 <lleb> tomsmeding content-type application/json; charset=utf-8 in the curl request and content-type application/json in the haskell one
2021-04-29 13:51:49 <lleb> i dont think that the charset part is mandatory
2021-04-29 13:51:56 <lleb> and yes those \ chars are sent to the server
2021-04-29 13:52:52 <tomsmeding> lleb: I don't think they should be sent
2021-04-29 13:53:04 <tomsmeding> and no the charset doesn't sound necessary usually
2021-04-29 13:53:32 <lleb> tomsmeding i dont think so neither and i didnt expect this behavior...
2021-04-29 13:54:08 <lleb> https://pastebin.com/vdQP0f2d
2021-04-29 13:54:46 <lleb> here is my code. I wanted to represent my request body as a string in the code, before passing it to setRequestBodyJSON, and i cant do that without adding the \ chars
2021-04-29 13:54:57 jgt joins (~jgt@88.225.221.135)
2021-04-29 13:55:08 × Tario quits (~Tario@garza.riseup.net) (Ping timeout: 246 seconds)
2021-04-29 13:55:48 <tomsmeding> lleb: are you _sure_ those \ characters are actually sent to the server?
2021-04-29 13:56:17 <tomsmeding> lleb: oh wait: are there " characters around your request body?
2021-04-29 13:56:34 malumore_ joins (~malumore@151.62.116.76)
2021-04-29 13:56:54 waleee-cl joins (uid373333@gateway/web/irccloud.com/x-qamskrartzxwuohd)
2021-04-29 13:57:00 <tomsmeding> I think the library is json-encoding your json string
2021-04-29 13:57:35 <tomsmeding> it takes a ToJson a => a, and you're passing it a String -- which can indeed be converted to json, but that's not what you wanted
2021-04-29 13:57:42 <lleb> tomsmeding indeed... here is the raw body that i get in requestbin : "{\"operationName\":null,\"variables\":{},\"query\":\"{\n pages {\n list {\n title\n }\n }\n}\n\"}"
2021-04-29 13:57:49 kuribas joins (~user@ip-188-118-57-242.reverse.destiny.be)
2021-04-29 13:58:02 <tomsmeding> yeah
2021-04-29 13:58:36 <lleb> tomsmeding let finalReq = setRequestBodyJSON requestBody req
2021-04-29 13:58:41 <lleb> here requestBody is a string
2021-04-29 13:58:41 <tomsmeding> try either getting an aeson json value object and passing that to setRequestBodyJSON, or using e.g. setRequestBodyLBS with the literal json string and set the content-type manually
2021-04-29 13:59:00 tomsmeding has to go unfortunately
2021-04-29 13:59:02 <tomsmeding> good luck!
2021-04-29 13:59:05 <lleb> ok... i expected ToJson a => a to turn my string into a json
2021-04-29 13:59:06 × malumore quits (~malumore@151.62.116.76) (Ping timeout: 260 seconds)
2021-04-29 13:59:13 <tomsmeding> it did!
2021-04-29 13:59:13 <lleb> thanks a lot tomsmeding
2021-04-29 13:59:16 rj joins (~x@gateway/tor-sasl/rj)
2021-04-29 13:59:25 <tomsmeding> but you don't want any conversion at all :p
2021-04-29 14:02:01 × __minoru__shirae quits (~shiraeesh@46.34.207.120) (Ping timeout: 260 seconds)
2021-04-29 14:03:24 × mikoto-chan quits (~mikoto-ch@gateway/tor-sasl/mikoto-chan) (Remote host closed the connection)
2021-04-29 14:04:43 mikoto-chan joins (~mikoto-ch@gateway/tor-sasl/mikoto-chan)
2021-04-29 14:10:03 Pickchea joins (~private@unaffiliated/pickchea)
2021-04-29 14:10:21 idhugo__ joins (~idhugo@80-62-116-231-mobile.dk.customer.tdc.net)
2021-04-29 14:11:35 × hypercube quits (~hypercube@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com) (Quit: WeeChat 3.1)
2021-04-29 14:13:21 Qwerky_ joins (~qwerky@37.170.132.154)
2021-04-29 14:14:11 __minoru__shirae joins (~shiraeesh@46.34.207.120)
2021-04-29 14:14:58 Tario joins (~Tario@201.192.165.173)
2021-04-29 14:16:33 × Qwerky quits (~qwerky@37.170.132.154) (Ping timeout: 265 seconds)
2021-04-29 14:16:37 hypercube joins (~hypercube@2603-6011-f901-9e5b-0000-0000-0000-08cf.res6.spectrum.com)
2021-04-29 14:17:22 × LKoen quits (~LKoen@22.249.88.92.rev.sfr.net) (Remote host closed the connection)
2021-04-29 14:17:28 Sheilong joins (uid293653@gateway/web/irccloud.com/x-cinqhqsiyvsglyzn)

All times are in UTC.