ocket8888 commented on a change in pull request #4951:
URL: https://github.com/apache/trafficcontrol/pull/4951#discussion_r471740829
##########
File path: traffic_monitor/datareq/datareq.go
##########
@@ -72,62 +73,62 @@ func MakeDispatchMap(
dispatchMap := map[string]http.HandlerFunc{
"/publish/CrConfig": wrap(WrapAgeErr(errorCount, func()
([]byte, time.Time, error) {
return srvTRConfig(opsConfig, toSession)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/CrStates": wrap(WrapParams(func(params url.Values,
path string) ([]byte, int) {
bytes, statusCode, err := srvTRState(params,
localStates, combinedStates, peerStates)
return WrapErrStatusCode(errorCount, path, bytes,
statusCode, err)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/CacheStats": wrap(WrapParams(func(params url.Values,
path string) ([]byte, int) {
return srvCacheStats(params, errorCount, path, toData,
statResultHistory, statInfoHistory, monitorConfig, combinedStates,
statMaxKbpses)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/DsStats": wrap(WrapParams(func(params url.Values,
path string) ([]byte, int) {
return srvDSStats(params, errorCount, path, toData,
dsStats)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/EventLog": wrap(WrapErr(errorCount, func() ([]byte,
error) {
return srvEventLog(events)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/PeerStates": wrap(WrapParams(func(params url.Values,
path string) ([]byte, int) {
return srvPeerStates(params, errorCount, path, toData,
peerStates)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/Stats": wrap(WrapErr(errorCount, func() ([]byte,
error) {
return srvStats(staticAppData, healthPollInterval,
lastHealthDurations, fetchCount, healthIteration, errorCount, peerStates)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/ConfigDoc": wrap(WrapErr(errorCount, func() ([]byte,
error) {
return srvConfigDoc(opsConfig)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/publish/StatSummary": wrap(WrapParams(func(params url.Values,
path string) ([]byte, int) {
return srvStatSummary(params, errorCount, path, toData,
statResultHistory)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/api/cache-count": wrap(WrapBytes(func() []byte {
return srvAPICacheCount(localStates)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/api/cache-available-count": wrap(WrapBytes(func() []byte {
return srvAPICacheAvailableCount(localStates)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/api/cache-down-count": wrap(WrapBytes(func() []byte {
return srvAPICacheDownCount(localStates, monitorConfig)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
"/api/version": wrap(WrapBytes(func() []byte {
return srvAPIVersion(staticAppData)
- }, ContentTypeJSON)),
+ }, rfc.ContentTypeTextPlain)),
"/api/traffic-ops-uri": wrap(WrapBytes(func() []byte {
return srvAPITrafficOpsURI(opsConfig)
- }, ContentTypeJSON)),
+ }, rfc.ApplicationJSON)),
Review comment:
As per #2565 (which this PR will fix, btw), `/api/traffic-ops-uri` does
not return a JSON-encoded response. `text/plain` would not be incorrect, but
[`text/uri-list`](https://tools.ietf.org/html/rfc2483#section-5) would be
better.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]