Skip to content

incorrect detection of http_response_header version #6

@shopapps

Description

@shopapps

in NlpClient.php line 175 you have:

if ( empty($result) || ( isset($http_response_header) && $http_response_header[0] != 'HTTP/1.0 200 OK' ) ) // empty if server is down

can you please move the check for the HTTP version to config?

if ( empty($result) || ( isset($http_response_header) && $http_response_header[0] != 'HTTP/' . config('nlp.http.version') . ' 200 OK' ) ) // empty if server is down

or even better:

if ( empty($result) || ( isset($http_response_header) && !stristr($http_response_header[0],  '200 OK' ))) // empty if server is down

currently, my local build returns: "HTTP/1.1 200 OK" (so HTTP/1.1 not HTTP/1.0 ) so all my attempts to use your laravel wrapper package are failing :-(

the output of my $http_response_header

"Web64\Nlp\NlpClient::post_call Line: 173" // vendor/web64/php-nlp-client/src/NlpClient.php:173
array:6 [ // vendor/web64/php-nlp-client/src/NlpClient.php:173
  0 => "HTTP/1.1 200 OK"
  1 => "Server: Werkzeug/2.3.4 Python/3.11.3"
  2 => "Date: Thu, 18 May 2023 10:19:01 GMT"
  3 => "Content-Type: application/json"
  4 => "Content-Length: 434"
  5 => "Connection: close"
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions