|
@@ -1,5 +1,6 @@
|
|
|
package com.gxzc.zen.umps.config
|
|
|
|
|
|
+import org.springframework.http.HttpMethod
|
|
|
import org.springframework.stereotype.Component
|
|
|
import org.springframework.web.filter.OncePerRequestFilter
|
|
|
import javax.servlet.FilterChain
|
|
@@ -21,6 +22,10 @@ class CORSFilter : OncePerRequestFilter() {
|
|
|
it.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, OPTIONS, DELETE")
|
|
|
it.setHeader("Access-Control-Max-Age", "3600")
|
|
|
it.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
|
|
|
+ val method = HttpMethod.valueOf(request.method)
|
|
|
+ if (method == HttpMethod.POST || method == HttpMethod.PUT) {
|
|
|
+ it.setHeader("Access-Control-Expose-Headers", "Location")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
filterChain.doFilter(request, response)
|