Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae57e5f

Browse files
committed
Throw on non-200 responses
1 parent 899180c commit ae57e5f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/GitHub/Request.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ parseStatus m (Status sci _) =
331331
-- Unit
332332
-------------------------------------------------------------------------------
333333

334-
instance Accept 'MtUnit
334+
instance Accept 'MtUnit where
335+
modifyRequest = Tagged setRequestIgnoreStatus
336+
335337
instance a ~ () => ParseResponse 'MtUnit a where
336338
parseResponse _ _ = Tagged (return ())
337339

@@ -378,7 +380,7 @@ makeHttpRequest auth r = case r of
378380
$ req
379381
where
380382
parseUrl' :: MonadThrow m => Text -> m HTTP.Request
381-
parseUrl' = HTTP.parseRequest . T.unpack
383+
parseUrl' = HTTP.parseUrlThrow . T.unpack
382384

383385
url :: Paths -> Text
384386
url paths = maybe "https://api.github.com" id (endpoint =<< auth) <> "/" <> T.intercalate "/" paths

0 commit comments

Comments
 (0)