Closed amvasil-v closed 4 months ago
I'm not sure, this behavior has been here from the beginning in #1. @Covertness do you remember the reasoning by chance, or have a preference on the matter?
I think it was used to build the response quickly. Of cource it can be deleted.
@martindisch @Covertness Thanks for a quick reply! Created PR #38.
Released in 0.12.0.
``While testing coap-rs, which is based on coap-lite, I noticed that coap server by default replies to the POST and PUT requests with an echo of the request, which is confusing. Moreover, it copies request payload to the reply messages to a block1 request, which is clearly a bug.
This happens because in
src/response.rs
in the functionpub fn new(request: &Packet)
:packet.payload = request.payload.clone();
request payload is always copied to the reply.Is there a particular reason to do it, or can this line be deleted? I think in all use cases user is actually responsible for populating
response.message.payload
.