Skip to content

Commit dcbee42

Browse files
committed
handle traces without response
closes codecentric#1358
1 parent 0725e3d commit dcbee42

File tree

1 file changed

+17
-17
lines changed
  • spring-boot-admin-server-ui/src/main/frontend/views/instances/httptrace

1 file changed

+17
-17
lines changed

spring-boot-admin-server-ui/src/main/frontend/views/instances/httptrace/index.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
- Copyright 2014-2019 the original author or authors.
2+
- Copyright 2014-2020 the original author or authors.
33
-
44
- Licensed under the Apache License, Version 2.0 (the "License");
55
- you may not use this file except in compliance with the License.
@@ -105,17 +105,17 @@
105105
</template>
106106

107107
<script>
108-
import subscribing from '@/mixins/subscribing';
109-
import Instance from '@/services/instance';
110-
import {concatMap, timer} from '@/utils/rxjs';
111-
import debounce from 'lodash/debounce';
112-
import mapKeys from 'lodash/mapKeys';
113-
import moment from 'moment';
114-
import {VIEW_GROUP} from '../../index';
115-
import sbaTracesChart from './traces-chart';
116-
import sbaTracesList from './traces-list';
108+
import subscribing from '@/mixins/subscribing';
109+
import Instance from '@/services/instance';
110+
import {concatMap, timer} from '@/utils/rxjs';
111+
import debounce from 'lodash/debounce';
112+
import mapKeys from 'lodash/mapKeys';
113+
import moment from 'moment';
114+
import {VIEW_GROUP} from '../../index';
115+
import sbaTracesChart from './traces-chart';
116+
import sbaTracesList from './traces-list';
117117
118-
const addToFilter = (oldFilter, addedFilter) =>
118+
const addToFilter = (oldFilter, addedFilter) =>
119119
!oldFilter
120120
? addedFilter
121121
: (val, key) => oldFilter(val, key) && addedFilter(val, key);
@@ -127,23 +127,23 @@
127127
Object.assign(this, trace);
128128
this.timestamp = moment(timestamp);
129129
this.request = {...request, headers: normalize(request.headers)};
130-
this.response = {...response, headers: normalize(response.headers)};
130+
this.response = response ? {...response, headers: normalize(response.headers)} : null;
131131
}
132132
133133
get key() {
134134
return `${this.timestamp.valueOf()}-${this.request.method}-${this.request.uri}`;
135135
}
136136
137137
get contentLength() {
138-
const contentLength = this.response.headers['content-length'] && this.response.headers['content-length'][0];
138+
const contentLength = this.response && this.response.headers['content-length'] && this.response.headers['content-length'][0];
139139
if (contentLength && /^\d+$/.test(contentLength)) {
140140
return parseInt(contentLength);
141141
}
142142
return null;
143143
}
144144
145145
get contentType() {
146-
const contentType = this.response.headers['content-type'] && this.response.headers['content-type'][0];
146+
const contentType = this.response && this.response.headers['content-type'] && this.response.headers['content-type'][0];
147147
if (contentType) {
148148
const idx = contentType.indexOf(';');
149149
return idx >= 0 ? contentType.substring(0, idx) : contentType;
@@ -156,15 +156,15 @@
156156
}
157157
158158
isSuccess() {
159-
return this.response.status <= 399
159+
return this.response && this.response.status <= 399
160160
}
161161
162162
isClientError() {
163-
return this.response.status >= 400 && this.response.status <= 499
163+
return this.response && this.response.status >= 400 && this.response.status <= 499
164164
}
165165
166166
isServerError() {
167-
return this.response.status >= 500 && this.response.status <= 599
167+
return this.response && this.response.status >= 500 && this.response.status <= 599
168168
}
169169
}
170170

0 commit comments

Comments
 (0)