-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: [CURLRequest] Multiple HTTP 100 return by API. #8466
Conversation
Since you were able to reproduce the issue, can you also provide a test case for this scenario? Thanks! |
@michalsn I'm afraid I can't do that, as this seems like a specific error that occurs when using a Python framework. To write a test case for this scenario, we would need to set up a Flask API service in advance, which I don't think is a good direction. However, I can provide the code I used when reproducing the issue. Reproduce In CI4 <?php
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class Home extends BaseController
{
use ResponseTrait;
public function index()
{
$client = \Config\Services::curlrequest();
try {
$options = [
'headers' => [
'Expect' => '100-continue'
],
'debug' => true,
];
$response = $client->request('GET', 'http://localhost:5000', $options);
// We'll get 100 until we fix it.
// After modification we will get 200.
dd($response->getStatusCode());
} catch (\Exception $e) {
echo "Request failed: " . $e->getMessage();
}
}
} In flask from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def hello_world():
return jsonify(message="Hello, World!")
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=5000) Also, you can get the repeat response by using curl command.
|
We don't need Flask. We tested output before, like here: https://github.com/codeigniter4/CodeIgniter4/blob/develop/tests/system/HTTP/CURLRequestTest.php#L385 |
We use
|
Description
Closes #8347
Checklist: