如何在API Blueprint中指定请求标头

时间:2015-05-13 09:03:19

标签: apiblueprint

我正在尝试为资源定义API蓝图,该资源利用请求标头来了解要返回的内容类型。

describe("as_admin", function() {
  beforeEach(function() {
    //log in as admin
  });

  describe('Services Page',function() {...});
  describe('Administrators Page',function() {...});

}

我希望我的要求如下: -

## Offer [/offers/{offerCode}]

+ Parameters
    + offerCode: summer2015 (required, string) - alphanumeric offer code

### View an Offer Detail [GET]

+ Response 200 (application/vnd.v0.1.0+json)

    {
        ........
    }

如何使用API​​ Blueprint记录该文档?

1 个答案:

答案 0 :(得分:14)

我不确定我是否理解你想要实现的目标,但我想说你想为请求指定标题,你可以通过以与响应相同的方式指定请求来实现。

## Offer [/offers/{offerCode}]

+ Parameters
    + offerCode: summer2015 (required, string) - alphanumeric offer code


### View an Offer Detail [GET]

+ Request 

    + Headers 

          Accept: application/vnd.v0.1.0+json 


+ Response 200 (application/vnd.v0.1.0+json)

    {
        ........
    }