KnpLabs / KnpLabs/php-github-api

RequestInterface shows invalid URI

Open
#611 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PHP
Stars
2.2k
Forks
587
PR merge metrics
No merged PRs in 30d

Description

I'm, always getting the `"Not found"` error on my api calls. Tried investigating and found this on the $request passed to the `RequestInterface::sendRequest()` method:

```
Request {#346 ▼
-method: "GET"
-requestTarget: null
-uri: Uri {#347 ▼
-scheme: ""
-userInfo: ""
-host: ""
-port: null
-path: "/user/repos"
-query: "type=owner&sort=full_name&direction=asc"
-fragment: ""
}
-headers: []
-headerNames: []
-protocol: "1.1"
-stream: null
}
```

Seems like the `path` parameter is missing some parameters even though $`github->currentUser()->show()` shows a complete response:

```
array:30 [▼
"login" => "myusername"
"id" => xxxxxxxxx
"avatar_url" => "https://avatars2.githubusercontent.com/u/xxxxxxxxx?v=3"
"gravatar_id" => ""
"url" => "https://api.github.com/users/myusername"
"html_url" => "https://github.com/myusername"
"followers_url" => "https://api.github.com/users/myusername/followers"
"following_url" => "https://api.github.com/users/myusername/following{/other_user}"
"gists_url" => "https://api.github.com/users/myusername/gists{/gist_id}"
"starred_url" => "https://api.github.com/users/myusername/starred{/owner}{/repo}"
"subscriptions_url" => "https://api.github.com/users/myusername/subscriptions"
"organizations_url" => "https://api.github.com/users/myusername/orgs"
"repos_url" => "https://api.github.com/users/myusername/repos"
"events_url" => "https://api.github.com/users/myusername/events{/privacy}"
"received_events_url" => "https://api.github.com/users/myusername/received_events"
"type" => "User"
"site_admin" => false
"name" => "My Name"
"company" => null
"blog" => "http://www.myusername.com"
"location" => null
"email" => "myusername@gmail.com"
"hireable" => true
"bio" => null
"public_repos" => 4
"public_gists" => 0
"followers" => 0
"following" => 0
"created_at" => "2013-03-05T03:52:44Z"
"updated_at" => "2017-06-28T06:59:13Z"
]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at RequestInterface::sendRequest() and inspect how the Request and Uri values shown in the report are assembled for the user-repositories call. Reproduce the API request and compare the resulting URI with the endpoint represented by the current-user response; done means the request no longer produces the reported "Not found" error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.