'Check if the response of a get api is a proto object
I fetch a proto
object from an api , is there anyway I can validate that the response
is a proto
object.
One thing which I did was check content-type
as mentioned in the json counterpart of this question. But the answer goes on further to validate json
using JSON.parse
The content-type of a proto file comes out to be application/octet-stream
( protobuf
can have this content-type
, check this )
Is there any other check I should do to validate response
is a proto
object ?
EDIT : Proto
means
Protocol Buffers : https://developers.google.com/protocol-buffers
Solution 1:[1]
The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied for sending). Meanwhile, protobuf is serialization/de-serialization schema/library. So they are different.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | rjhcnf |