CouchDB utilizes HTTP for all correspondence, and have to guarantee that all the appropriate headers of HTTP are outfitted with the goal that have been getting the right configurations and encodings. Different situations and users will be pretty much strict on the impact of these HTTP headers and this HTTP headers consists of
HTTP Request Header
HTTP Response Header
HTTP Request Header
Description
HTTP headers should be outfitted for accessing the correct arrangement and encoding. All though at the time of sending the solicitations to the server, one can transfer Http request headers along with the request. The accompanying are the diverse Http solicitations headers.
Content type
Accepted
Content type
Description
Determines the content type of data that as been equipped inside the solicitation and these conditions utilises MIME sort of determinations. Considering the greater part of solicitations this will be JSON. In some of the settings, the MIME sort will be in plain content. While transferring connections, it ought to be the relating MIME sort for the connection or binary.
Accepted
Description
Header are utilised to indicate the server, the rundown of data sorts that the user can discern, so that the server will transfer its response by utilising these information sorts. Typically here, one can transfer the rundown of MIME information sorts for which the user acknowledges, isolated by colons. For instance, when transferring a solicitation beyond with an Accept header in explicit, or while indicating */*:
[c]GET /recipes HTTP/1.1 Host: couchbase:5984 Accept: */* [/c]
And the header returned are
[c]Server: CouchDB/1.0.1 (Erlang OTP/R13B)
Date: Tuesday, 16 Aug 2016 13:39:34 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 227
Cache-Control: must-re validate
Here in the above example the header returned is in plain text against to the JSON format.[/c]
Explicitly specifying the Accept header:
[c]GET /recipes HTTP/1.1 Host: couchbase:5984 Accept: application/json [/c]
The headers returned include the application/json content type: Server:
[c]CouchDB/1.0.1 (Erlang OTP/R13B)
Date: Tuesday, 16 Aug 2016 13:40:11 GMT
Content-Type: application/json
Content-Length: 227
Cache-Control: must-revalidate[/c]
HTTP Response Header
Description
The HTTP Respone headers are rebounded from the server while transferring backs the contented and incorporate various diverse header fields, a large number of which are standard response header of HTTP and have no interpretations with the operations that are related to CouchDB. The accompanying are the list of HTTP response headers in couchDB database.
Content-type
Cache-control
Etag
Content-length
Content-type
Description
This header determines the MIME kind of the information returned by the server. For most solicatation, the returned MIME sort is in content/plain.
Cache-control
Description
The cache control header recommends the user regarding accelerating the data transferred by the server. CouchDB for the most part returns the revalidate, which demonstrates that the data ought to be re validated if conceivable.
Content-length
Description
The content-length header gives back the content that is transferred by the server, in bytes.
Etag
Description
The Etag header is utilised for demonstrating all the updatations for a report, or a perspective.
Summary
Key Points
CouchDB With Rails HTTP Headers - Guarantee that all the appropriate headers of HTTP are outfitted with the goals that have been encoded.
HTTP Request Header - Accessing the correct arrangement and encoding.
HTTP Response Header - Are rebounded from the server when transferring back the content.