mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-26 23:54:07 +03:00
Add header info to responses
This commit is contained in:
parent
f538d15ece
commit
79534e2987
|
@ -1,6 +1,16 @@
|
|||
<h2 class="responses-list-header" *ng-if="data.responses.length"> Responses </h2>
|
||||
<zippy *ng-for="#response of data.responses" title="{{response.code}} {{response.description}}"
|
||||
[type]="response.type" [empty]="!response.schema">
|
||||
<div *ng-if="response.headers" class="response-headers">
|
||||
<header>
|
||||
Headers
|
||||
</header>
|
||||
<div class="header" *ng-for="#header of response.headers">
|
||||
<div class="header-name"> {{header.name}} </div>
|
||||
<div class="header-type"> {{header.type}} </div>
|
||||
<div class="header-description" inner-html="{{header.description | marked}}"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<json-schema *ng-if="response.schema" class="schema type" pointer="{{response.pointer}}/schema">
|
||||
</json-schema>
|
||||
</zippy>
|
||||
|
|
|
@ -38,6 +38,14 @@ export default class ResponsesList extends BaseComponent {
|
|||
|
||||
resp.code = respCode;
|
||||
resp.type = statusCodeType(resp.code);
|
||||
if (resp.headers) {
|
||||
resp.headers = Object.keys(resp.headers).map((k) => {
|
||||
let respInfo = resp.headers[k];
|
||||
respInfo.name = k;
|
||||
return respInfo;
|
||||
});
|
||||
}
|
||||
resp.extendable = resp.headers || resp.length;
|
||||
return resp;
|
||||
});
|
||||
this.data.responses = responses;
|
||||
|
|
|
@ -4,3 +4,22 @@
|
|||
margin: 0.5em 0;
|
||||
color: #253137;
|
||||
}
|
||||
|
||||
.header-name {
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.header-type {
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.response-headers header {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.header {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user