uNetworking / uWebSockets

Simple, secure & standards compliant web server for the most demanding of applications
Apache License 2.0
17.29k stars 1.75k forks source link

uWS::HttpRequest setHeaders #1721

Closed devindasrinath closed 6 months ago

devindasrinath commented 6 months ago

Hi, I am currently writing unit tests for some methods which use a object of HttpRequest. In these methods, various functions such as getHeaders, getUrl, and so on are utilized. To write the unit test for this methods, I need to add some headers and URLs for this objects at the beginning. However, there are no setter methods in the HttpRequest class. Can someone help me find a way to resolve this? Thank you.

uNetworkingAB commented 6 months ago

HttpRequest is read only and doesn't work like a generic key/value container. Its hard to write any unit test only for the getters, you would have to write a unit test for the parser instead. But those are already written (but could be expanded