Skip to content

Commit ee4bfd2

Browse files
authored
Fix error with request ToString (#1125)
* Fix error with request ToString * Update request.cc
1 parent 6acdc7b commit ee4bfd2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/rest/request.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ void Request::set_post_fields(const char* data) {
4545

4646
std::string Request::ToString() {
4747
std::string output = options_.url + '\n';
48+
size_t cached_offset = read_buffer_offset_;
4849
if (!ReadBodyIntoString(&output)) {
4950
output += "*** aborted ***\n";
5051
}
5152
output += "\n";
53+
// Reset the buffer offset, since the read moves it.
54+
read_buffer_offset_ = cached_offset;
5255
return output;
5356
}
5457

0 commit comments

Comments
 (0)