Skip to content

Commit 0e39907

Browse files
committed
fix: apply headers in unix socket requests
1 parent cd50797 commit 0e39907

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

src/UNIXSocketRequest.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void UNIXSocketRequest::download(std::variant<TRequestParameters<std::string>,
4242
GetRequest::builder(FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))
4343
.url(arg.url.url(), arg.secureCommunication)
4444
.unixSocketPath(arg.url.unixSocketPath())
45+
.appendHeaders(arg.httpHeaders)
4546
.timeout(timeout)
4647
.userAgent(userAgent)
4748
.outputFile(outputFile)
@@ -102,9 +103,10 @@ void UNIXSocketRequest::post(std::variant<TRequestParameters<std::string>,
102103
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
103104
req.url(arg.url.url(), arg.secureCommunication)
104105
.unixSocketPath(arg.url.unixSocketPath())
106+
.template postData<const std::string&>(arg.data)
107+
.appendHeaders(arg.httpHeaders)
105108
.timeout(timeout)
106109
.userAgent(userAgent)
107-
.template postData<const std::string&>(arg.data)
108110
.outputFile(outputFile)
109111
.execute();
110112
std::visit(
@@ -128,9 +130,10 @@ void UNIXSocketRequest::post(std::variant<TRequestParameters<std::string>,
128130
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
129131
req.url(arg.url.url(), arg.secureCommunication)
130132
.unixSocketPath(arg.url.unixSocketPath())
133+
.template postData<std::string_view>(arg.data)
134+
.appendHeaders(arg.httpHeaders)
131135
.timeout(timeout)
132136
.userAgent(userAgent)
133-
.template postData<std::string_view>(arg.data)
134137
.outputFile(outputFile)
135138
.execute();
136139

@@ -156,9 +159,10 @@ void UNIXSocketRequest::post(std::variant<TRequestParameters<std::string>,
156159
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
157160
req.url(arg.url.url(), arg.secureCommunication)
158161
.unixSocketPath(arg.url.unixSocketPath())
162+
.template postData<const std::string&>(data)
163+
.appendHeaders(arg.httpHeaders)
159164
.timeout(timeout)
160165
.userAgent(userAgent)
161-
.template postData<const std::string&>(data)
162166
.outputFile(outputFile)
163167
.execute();
164168

@@ -234,6 +238,7 @@ void UNIXSocketRequest::get(std::variant<TRequestParameters<std::string>,
234238
GetRequest::builder(FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
235239
req.url(arg.url.url(), arg.secureCommunication)
236240
.unixSocketPath(arg.url.unixSocketPath())
241+
.appendHeaders(arg.httpHeaders)
237242
.timeout(timeout)
238243
.userAgent(userAgent)
239244
.outputFile(outputFile)
@@ -309,9 +314,10 @@ void UNIXSocketRequest::put(std::variant<TRequestParameters<std::string>,
309314
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
310315
req.url(arg.url.url(), arg.secureCommunication)
311316
.unixSocketPath(arg.url.unixSocketPath())
317+
.template postData<const std::string&>(arg.data)
318+
.appendHeaders(arg.httpHeaders)
312319
.timeout(timeout)
313320
.userAgent(userAgent)
314-
.template postData<const std::string&>(arg.data)
315321
.outputFile(outputFile)
316322
.execute();
317323

@@ -336,9 +342,10 @@ void UNIXSocketRequest::put(std::variant<TRequestParameters<std::string>,
336342
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
337343
req.url(arg.url.url(), arg.secureCommunication)
338344
.unixSocketPath(arg.url.unixSocketPath())
345+
.template postData<std::string_view>(arg.data)
346+
.appendHeaders(arg.httpHeaders)
339347
.timeout(timeout)
340348
.userAgent(userAgent)
341-
.template postData<std::string_view>(arg.data)
342349
.outputFile(outputFile)
343350
.execute();
344351

@@ -363,6 +370,7 @@ void UNIXSocketRequest::put(std::variant<TRequestParameters<std::string>,
363370
auto req {PutRequest::builder(
364371
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
365372
req.url(arg.url.url(), arg.secureCommunication)
373+
.unixSocketPath(arg.url.unixSocketPath())
366374
.template postData<const std::string&>(data)
367375
.appendHeaders(arg.httpHeaders)
368376
.timeout(timeout)
@@ -445,9 +453,10 @@ void UNIXSocketRequest::patch(std::variant<TRequestParameters<std::string>,
445453
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
446454
req.url(arg.url.url(), arg.secureCommunication)
447455
.unixSocketPath(arg.url.unixSocketPath())
456+
.template postData<const std::string&>(arg.data)
457+
.appendHeaders(arg.httpHeaders)
448458
.timeout(timeout)
449459
.userAgent(userAgent)
450-
.template postData<const std::string&>(arg.data)
451460
.outputFile(outputFile)
452461
.execute();
453462

@@ -472,9 +481,10 @@ void UNIXSocketRequest::patch(std::variant<TRequestParameters<std::string>,
472481
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
473482
req.url(arg.url.url(), arg.secureCommunication)
474483
.unixSocketPath(arg.url.unixSocketPath())
484+
.template postData<std::string_view>(arg.data)
485+
.appendHeaders(arg.httpHeaders)
475486
.timeout(timeout)
476487
.userAgent(userAgent)
477-
.template postData<std::string_view>(arg.data)
478488
.outputFile(outputFile)
479489
.execute();
480490

@@ -500,9 +510,10 @@ void UNIXSocketRequest::patch(std::variant<TRequestParameters<std::string>,
500510
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
501511
req.url(arg.url.url(), arg.secureCommunication)
502512
.unixSocketPath(arg.url.unixSocketPath())
513+
.template postData<const std::string&>(data)
514+
.appendHeaders(arg.httpHeaders)
503515
.timeout(timeout)
504516
.userAgent(userAgent)
505-
.template postData<const std::string&>(data)
506517
.outputFile(outputFile)
507518
.execute();
508519

@@ -578,6 +589,7 @@ void UNIXSocketRequest::delete_(std::variant<TRequestParameters<std::string>,
578589
FactoryRequestWrapper<wrapperType>::create(response, handlerType, shouldRun))};
579590
req.url(arg.url.url(), arg.secureCommunication)
580591
.unixSocketPath(arg.url.unixSocketPath())
592+
.appendHeaders(arg.httpHeaders)
581593
.timeout(timeout)
582594
.userAgent(userAgent)
583595
.outputFile(outputFile)

0 commit comments

Comments
 (0)