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

Publish HttpFactory #428

Closed
Art4 opened this issue Oct 10, 2024 · 0 comments · Fixed by #429
Closed

Publish HttpFactory #428

Art4 opened this issue Oct 10, 2024 · 0 comments · Fixed by #429
Assignees
Milestone

Comments

@Art4
Copy link
Collaborator

Art4 commented Oct 10, 2024

While working on #426 I noticed that there is no convenient alternative to call \Redmine\Http\HttpClient::request() because one has to implement the \Redmine\Http\Request interface beforehand.

Internally we are using the class \Redmine\Http\HttpFactory to create Request and Response instances. This factory class is marked as internal. I propose to make this class publicly available to make the use of \Redmine\Http\HttpClient::request() much more easier.

See also #401 (comment). The HttpFactory will reduce the needed code to:

$response = $client->request(
    \Redmine\Http\HttpFactory::makeJsonRequest(
        'POST',
        '/time_entries.json',
        \Redmine\Serializer\JsonSerializer::createFromArray(['time_entry' => $data])->getEncoded(),
    ),
);

#391 proposes the deprecation of this methods:

  • Redmine\Client\Client::getLastResponseStatusCode()
  • Redmine\Client\Client::getLastResponseContentType()
  • Redmine\Client\Client::getLastResponseBody()

But publishing HttpFactory will allow us to deprecate even more methods:

  • Deprecate Redmine\Client\Client::requestGet()
  • Deprecate Redmine\Client\Client::requestPost()
  • Deprecate Redmine\Client\Client::requestPut()
  • Deprecate Redmine\Client\Client::requestDelete()

Deprecating this methods was also kept in mind while designing the \Redmine\Http\HttpClient::request() method, see #341.

@Art4 Art4 added this to the v2.8.0 milestone Oct 10, 2024
@Art4 Art4 self-assigned this Oct 10, 2024
@Art4 Art4 closed this as completed in #429 Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant