Running HTTP(s) queries every day with ArdorQuery: Part 3 HTTP Headers
Published: 2023-10-21 14:32:55

If you're currently developing a web application, it's highly likely that you have an API, be it a REST API, a GraphQL API, or any other API. This means that HTTP queries must be made daily for development and testing. There are a huge number of tools available for running HTTP queries, such as cURL and Postman etc. I would like to tell you about a tool that I made for myself, but it might be useful for you too, it's called ArdorQuery. In this article, you will learn how to use the ArdorQuery application on a daily basis to make HTTP queries. The application is oriented on keyboard and allows you to separate parts of your query as human-readable strings. Strings are highlighted in different colors depending on the type of content. More [information about application or download](https://github.com/trueromanus/ArdorQuery). In this part, we will discuss how to work with HTTP Headers.

HTTP Headers are an important part of an HTTP query; using them we can specify many different things, for example what type of content we can accept, how to compress the response and much more.
To add a HTTP Header in an application, add a new line by pressing (Ctrl-Enter). The HTTP protocol has a standard set of headers such as `Authorization`, `Content-Type`, etc. Standard HTTP Headers can be specified in the format `<Header Name> <Header Value>`. For example, to define the request type, you need to write `Content-Type application/json`. To specify a bearer token, you need to write `Authorization Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9`.
![Standart Header Example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sxlwv4wrjxsd3ijkz8l7.png)

In addition to standard headers, you can use non-standard ones that support only specific websites or services. Some time ago, it was fashionable to add an `X-` prefix to non-standard HTTP Headers to visually distinguish them from standard ones. The application supports such headers, you can write as example `X-MYCUSTOMHEADER 123`.
![Non standart header example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1o738n8iluw13baqks0o.png)

The modern way to add non-standard HTTP Headers is to simply add any words or combinations of words that are not in the standard set and use it on your server. In application you can create new line with following content `header <Header Name> <Header Value>`. 
![Moder header example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4wsnnyn5rg6hewppna7.png)

When sending requests, the application will only add HTTP Headers needed to complete the request. You can override all the standard HTTP Headers if you want to have more control over which headers and values should be part of the request.

Among the standard headers is the cookie header. It represents itself as a dictionary and can contains session specific data. The contents of the dictionary are written as a single delimited string. It is not always convenient to fill out this header as a single line, so you can set values for individual keys for this header creating line with content `pastry <cookie key>=<value>`. As example `pastry TOKEN=MYTOKEN123`. But you need to know if you define header `Cookie` itself, all lines with pastry fields will be ignored.