gr2m / gr2m/octokit-plugin-create-pull-request

Update file: handle case if no file exists at the path, or the response is something other than a file

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
TypeScript
Stars
116
Forks
31
PR merge metrics
No merged PRs in 30d

Description

See https://developer.github.com/v3/repos/contents/#get-repository-content

The `GET /repos/:owner/:repo/contents/:path` endpoint can have 4 different types of responses

1. A file
2. A directory
3. A Symlink
4. A Submodule

It can also respond with a `404` nothing exists at the given path.

We should probably throw errors for response types 2-4, and pass `null` to the function in case of a `404` response

See [CONTRIBUTING.md](https://github.com/gr2m/octokit-plugin-create-pull-request/blob/master/CODE_OF_CONDUCT.md) for instructions on how to record fixtures for a new test, if needed

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.