Skip to content

Commit 3a79eef

Browse files
authored
Fix panic in "cf curl" command when response contains {{ or }} (#3618)
* for details, see #3594
1 parent 47c3f47 commit 3a79eef

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

command/v7/curl_command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (cmd CurlCommand) Execute(args []string) error {
6969
}
7070
cmd.UI.GetOut().Write(responseBodyBytes)
7171
} else {
72-
cmd.UI.DisplayText(string(bytesToWrite))
72+
cmd.UI.DisplayTextLiteral(string(bytesToWrite))
7373
}
7474

7575
return nil

command/v7/curl_command_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,17 @@ var _ = Describe("curl Command", func() {
9797
Expect(testUI.Out).To(Say("sarah, teal, and reid were here"))
9898
})
9999

100+
When("the request contains double curly braces", func() {
101+
BeforeEach(func() {
102+
fakeActor.MakeCurlRequestReturns([]byte("{{ }}"), &http.Response{}, nil)
103+
})
104+
105+
It("returns the literal text", func() {
106+
Expect(executeErr).NotTo(HaveOccurred())
107+
Expect(testUI.Out).To(Say("{{ }}"))
108+
})
109+
})
110+
100111
When("the request errors", func() {
101112
BeforeEach(func() {
102113
fakeActor.MakeCurlRequestReturns([]byte{}, &http.Response{}, errors.New("this sucks"))

0 commit comments

Comments
 (0)