Skip to content

Code.Content-Type header#688

Open
alexander-b-clean wants to merge 6 commits into
devfrom
content-type-header.ab
Open

Code.Content-Type header#688
alexander-b-clean wants to merge 6 commits into
devfrom
content-type-header.ab

Conversation

@alexander-b-clean

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds centralized Content-Type handling for Remote Call responses in the CleantalkSP\SpbctWP\RemoteCalls layer, plus a PHPUnit test to validate the action→Content-Type mapping.

Changes:

  • Introduces a default response Content-Type constant and an action→Content-Type lookup table.
  • Sends a Content-Type header during remote call initialization based on spbc_remote_call_action.
  • Adds a PHPUnit test suite covering the resolver behavior for known actions and fallbacks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
lib/CleantalkSP/SpbctWP/RemoteCalls.php Adds content-type constants/mapping, resolver, and header emission in the RC constructor.
tests/lib/CleantalkSP/SpbctWP/RemoteCalls/RemoteCallsContentTypeTest.php Adds unit tests validating content-type resolution for several remote-call actions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/CleantalkSP/SpbctWP/RemoteCalls.php
Comment on lines +67 to +76
/**
* Resolve the full Content-Type header value for action.
*
* @param string $action
* @return string
*/
public static function resolveContentType($action)
{
$action = strtolower((string)$action);

Comment thread lib/CleantalkSP/SpbctWP/RemoteCalls.php
alexander-b-clean and others added 5 commits July 17, 2026 17:39
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants