curl-header tagged requests and articles

Categorized request examples and articles tagged with [curl-header] keyword
How to send HTTP header with Curl request?
To send an HTTP header with a Curl request, you can use the -H command-line option and pass the header name and value in "Key: Value" format. If you do not provide a value for the header, this will remove the standard header that Curl would otherwise send. The number of HTTP headers is unlimited. You can add as many headers to the Curl request as you need. In this Curl header example, we send the X-Custom-Header and Content-Type request headers to the ReqBin echo URL. Click Run to execute the Curl Send Header Request online and see the results.

How to force Curl to close the connection after response?
Curl tries to keep connections open and reuse existing connections. To close a connection after a request, you can send a "Connection: close" HTTP header to the server. The Connection: close header informs the server that the client wants to close the connection after completing the HTTP transaction. It's up to the server to close the connection after the request or not. You can use the- H command-line option to pass the "Connection: close" header to Curl. In this Curl Close Connection example, we send a request to the ReqBin echo URL with the corresponding header. Click Run to execute the Сurl Сommand with Сlose Сonnection Header example online and see the result.

How to send Curl keep-alive request?
Curl keeps connections open and reuses existing ones when possible. If you need to pass the Connection: keep-alive header to Curl, you can use the -H command line option. The Keep-Alive Connection means the server will not close the Connection after making the request. HTTP clients may specify the additional persistent connection options in a separate - H "Keep-Alive: [options]" HTTP header. In this Curl Keep-AliveConnection Example, we send a keep-alive request to the ReqBin echo URL. Click Run to execute the Curl Command with Keep-Alive Connection Header online and see the results.