jenssegers / jenssegers/php-chef

Partial search POST issue found

Open
#14 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
20
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Hi,

When attempting a partial search using POST, I found an issue in the api() method when assigning the $url variable. I have made the following change shown in this code snippet. Have and look and try it out. You'll see that when ?q=name:foobar is passed in as the url, it needs to be removed from the endpoint but retained on the url. Here's the code snippet:

``` php
$parts = parse_url($endpoint);
if (isset($parts['host'])) {
// split server and endpoint
$endpoint = $parts['path'];
$url = $this->server . $endpoint;
} else {
// prepend own server to endpoint
// RCallahan 01/07/2025 - changed $endpoint for $parts['path'] in ltrim() below
$endpoint = '/' . ltrim($parts['path'], '/');
$url = $this->server . $endpoint . (array_key_exists('query', $parts) ? '?' . $parts['query'] : '');
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.