REST APIs: custom HTTP headers vs URL parameters

后端 未结 8 1245
太阳男子
太阳男子 2020-12-12 11:41

When do you use custom HTTP headers in the request part of a REST API ?

Example:

Would you ever use

GET /orders/view 
(custom HTTP header)          


        
8条回答
  •  不思量自难忘°
    2020-12-12 12:05

    Custom headers have the following advantages:

    • Can be read easily by network tools/scripts (authentication, meta info, ...)
    • Keeps urls free from security stuff (safer, not in browser/proxy caches)
    • Keeps urls cleaner: allows for better caching of resources

提交回复
热议问题