测试gzip过滤器已启用

时间:2019-06-28 00:06:51

标签: playframework gzip

我想添加一个测试以确保未禁用GzipFilter

我已启用GzipFilter,并且在应用程序运行时,响应已按预期压缩,但在测试中却未压缩。虽然,配置显示已启用GzipFilter

df = (
    df
    .assign(rolling_5d_avg=df.rolling(window=5*24*60)['Value'].mean())
    .groupby(df['Time'].dt.date)['rolling_5d_avg']
    .last()
)

>>> df.head(10)
Time
2018-01-01         NaN
2018-01-02         NaN
2018-01-03         NaN
2018-01-04         NaN
2018-01-05    5.786603
2018-01-06    5.784011
2018-01-07    5.790133
2018-01-08    5.786967
2018-01-09    5.789944
2018-01-10    5.789299
Name: rolling_5d_avg, dtype: float64
play {
  i18n.langs = ["en"]
  server.netty.maxInitialLineLength = 16384

  modules {
    enabled += mdsol.clients.AuthenticatedWSClientModule
    enabled += mdsol.clients.MAuthServiceModule
    enabled += jp.co.bizreach.trace.play.module.ZipkinModule
  }

  filters {
    enabled += filters.HeaderValidatorFilter
    enabled += jp.co.bizreach.trace.play.filter.ZipkinTraceFilter
    enabled += filters.CSelectionsFilter
    enabled += filters.XMwsUserFilter
    enabled += play.filters.gzip.GzipFilter

    headers {
      frameOptions = "SAMEORIGIN"
    }

    gzip {
      chunkedThreshold = 100k
      compressionLevel = 9
      contentType {
        # If non empty, then a response will only be compressed if its content type is in this list.
        whiteList = ["application/javascript", "application/json", "text/css"]
      }
    }
  }
}

有什么想法吗?

0 个答案:

没有答案