Fix regression in --output when output file doesn't exist.
This commit is contained in:
parent
16b1e6b72d
commit
062e2ab0f8
|
|
@ -1,3 +1,6 @@
|
|||
[5.0.1 (TO_BE_DEFINED)](https://github.com/Orange-OpenSource/hurl/blob/master/CHANGELOG.md#5.0.1)
|
||||
========================================================================================================================
|
||||
|
||||
[5.0.0 (2024-08-29)](https://github.com/Orange-OpenSource/hurl/blob/master/CHANGELOG.md#5.0.0)
|
||||
========================================================================================================================
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1 @@
|
|||
Response endpoint2
|
||||
Response endpoint2
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# We test that --output truncates an existing file then appends it.
|
||||
|
||||
echo "Not a response" > build/output.bin
|
||||
if (Test-Path build/output.bin) {
|
||||
Remove-Item build/output.bin
|
||||
}
|
||||
|
||||
hurl --output build/output.bin tests_ok/output.hurl tests_ok/output.hurl
|
||||
hurl --output build/output.bin tests_ok/output.hurl
|
||||
Write-Host (Get-Content build/output.bin -Raw) -NoNewLine
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# We test that --output truncates an existing file then appends it.
|
||||
rm -f build/output.bin
|
||||
|
||||
echo "Not a response" > build/output.bin
|
||||
|
||||
hurl --output build/output.bin tests_ok/output.hurl tests_ok/output.hurl
|
||||
hurl --output build/output.bin tests_ok/output.hurl
|
||||
cat build/output.bin
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
# Test the option --output (see <https://hurl.dev/docs/manual.html#output>)
|
||||
POST http://localhost:8000/output/endpoint1
|
||||
{ "user": "bob" }
|
||||
HTTP 200
|
||||
|
||||
|
||||
GET http://localhost:8000/output/endpoint2
|
||||
HTTP 200
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
Response endpoint2
|
||||
Response endpoint2
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
Set-StrictMode -Version latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# We test that --output truncates an existing file then appends it.
|
||||
|
||||
echo "Not a response" > build/output_existing.bin
|
||||
|
||||
hurl --output build/output_existing.bin tests_ok/output_existing.hurl tests_ok/output_existing.hurl
|
||||
Write-Host (Get-Content build/output_existing.bin -Raw) -NoNewLine
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -Eeuo pipefail
|
||||
|
||||
# We test that --output truncates an existing file then appends it.
|
||||
|
||||
echo "Not a response" > build/output_existing.bin
|
||||
|
||||
hurl --output build/output_existing.bin tests_ok/output_existing.hurl tests_ok/output_existing.hurl
|
||||
cat build/output_existing.bin
|
||||
|
|
@ -64,6 +64,7 @@ impl Output {
|
|||
Output::Stdout => stdout.write_all(bytes)?,
|
||||
Output::File(filename) => {
|
||||
let mut file = OpenOptions::new()
|
||||
.create(true)
|
||||
.write(true)
|
||||
.append(append)
|
||||
.open(filename)?;
|
||||
|
|
|
|||
Loading…
Reference in New Issue