Assignment to a StringPiece doesn't cause a copy, the StringPiece is just a wrapper around a pointer to the underlying data of whatever you assigned it to. But looking at ps_request_body_to_string_piece, I think it also sets the output StringPiece to something in the passed in ngx_http_request_t, so I assume that still exists after the function returns. It would still be clearer to me to just pass in a GoogleString and append the parsed query param to the end of it, which I think is what MPS does. It's just odd to me to see a StringPiece used for output, but I don't think it's wrong in this case.