Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteComment: "Error in $: not enough input" #377

Closed
pbrisbin opened this issue May 30, 2019 · 3 comments
Closed

deleteComment: "Error in $: not enough input" #377

pbrisbin opened this issue May 30, 2019 · 3 comments

Comments

@pbrisbin
Copy link
Contributor

Repro

Save to ./gh-repro.hs

{-# LANGUAGE OverloadedStrings #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import GitHub.Endpoints.Issues.Comments
import System.Environment (getEnv)

main :: IO ()
main = do
    let owner = "restyled-io"
        repo = "restyled.io"
        issue = IssueNumber 155
    auth <- OAuth . C8.pack <$> getEnv "GITHUB_ACCESS_TOKEN"
    Right comment <- createComment auth owner repo issue "Test comment"

    result <- deleteComment auth owner repo $ commentId comment

    print result
GITHUB_ACCESS_TOKEN=<something with repo scopes> \
  stack runghc --resolver lts-13.23 --package github-0.21 ./gh-repro.hs

Expected

The comment is removed and the API response successfully returned according to deleteCommentR's type as:

Right ()

Actual

The comment is removed, but the result is an error in Left:

Left (ParseError "Error in $: not enough input")

Hypothesis

The commonly-used Request synonym fixes to MtJSON, but an endpoint such as this returns 204 No Content, so trying to parse no content to () fails. I'm guessing such an endpoint function needs to use MtUnit.

@phadej
Copy link
Contributor

phadej commented May 31, 2019

Changing media-type to MtUnit might fix this.

Please try, and if it works, make a PR!

@phadej
Copy link
Contributor

phadej commented May 31, 2019

Hopefully fixed in 0247582

@phadej phadej closed this as completed May 31, 2019
@pbrisbin
Copy link
Contributor Author

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants