fix: [CURLRequest] Multiple HTTP 100 return by API. - #8466
Merged
Merged
Conversation
Member
|
Since you were able to reproduce the issue, can you also provide a test case for this scenario? Thanks! |
Contributor
Author
|
@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. |
Member
|
We don't need Flask. We tested output before, like here: https://github.com/codeigniter4/CodeIgniter4/blob/develop/tests/system/HTTP/CURLRequestTest.php#L385 |
Member
|
We use |
Contributor
Author
kenjis
reviewed
Jan 28, 2024
kenjis
reviewed
Feb 14, 2024
kenjis
approved these changes
Feb 14, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #8347
Checklist: