Skip to content

Bug: curlrequest not using baseURI on localhost #4707

Closed
@lumin888

Description

@lumin888

Describe the bug
I've just updated to the latest release (from v4.0.4) and noticed my previously working curlrequest code is broken on my development environment.

The baseURI I supply in the options is not used. Instead, it uses the CI project's URL as the baseURI.

This issue occurs when the baseURI is on localhost. Changing the baseURI to something other than localhost works as expected.

Has something changed in the way curlrequest works on localhost?

CodeIgniter 4 version
CI 4.1.2 - failed
CI 4.0.4 - working

Affected module(s)
Unsure

Expected behavior, and steps to reproduce if appropriate
My CI controller is located at appstarter/app/Controllers/example.php

It contains this fragment:

$options = [
        'baseURI' => 'http://localhost/api/v1/'
];

$client = \Config\Services::curlrequest($options);

$response = $client->get('some/function/');

If I execute via http://localhost/appstarter/public/example, the get request attempts to fetch http://localhost/appstarter/public/api/v1/some/function, which does not exist.

I would have expected the get request to fetch http://localhost/api/v1/some/function

Context

  • OS: Windows 10
  • Web server: Xammp 7.4.18
  • PHP version: 7.4.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions