mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
Fix single quotes issue with PHP
This commit is contained in:
1
test/curl18.txt
Normal file
1
test/curl18.txt
Normal file
@@ -0,0 +1 @@
|
||||
curl google.com --data 'field=don%27t%20you%20like%20quotes'
|
||||
7
test/php_output18.php
Normal file
7
test/php_output18.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
include('vendor/rmccue/requests/library/Requests.php');
|
||||
Requests::register_autoloader();
|
||||
$data = array(
|
||||
'field' => 'don\'t you like quotes'
|
||||
);
|
||||
$response = Requests::post('google.com', $headers, $data);
|
||||
10
test/test.js
10
test/test.js
@@ -164,6 +164,14 @@ test('http post with data - php', function (t) {
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with quotes inside data - php', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl18.txt', 'utf-8');
|
||||
var phpCode = curlconverter.toPhp(curlHttpPostCommand);
|
||||
var goodPhpCode = fs.readFileSync(__dirname + '/php_output18.php', 'utf-8').trim();
|
||||
t.equal(phpCode, goodPhpCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http get with single header - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl8.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
@@ -245,4 +253,4 @@ test('http put with file - python', function (t) {
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output9.py', 'utf-8');
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user