Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: swagger-api/swagger-core
base: c826d74442
...
head fork: swagger-api/swagger-core
compare: 3e16274a63
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 20, 2012
@jaliss jaliss Added a Access-Control-Allow-Origin response header to allow the docu…
…mentation UI to access resource information
fd09a1e
Commits on Apr 21, 2012
@fehguy fehguy Merge pull request #21 from jaliss/master
Access-Control-Allow-Origin added to response
3e16274
Showing with 3 additions and 1 deletion.
  1. +3 −1 modules/swagger-play2/app/controllers/ApiHelpController.scala
View
4 modules/swagger-play2/app/controllers/ApiHelpController.scala
@@ -41,6 +41,7 @@ class SwaggerBaseApiController extends Controller {
protected def jaxbContext(): JAXBContext = JAXBContext.newInstance(classOf[String])
protected def returnXml(request: Request[_]) = request.path.contains(".xml")
protected val ok = "OK"
+ protected val AccessControlAllowOrigin = ("Access-Control-Allow-Origin", "*")
protected def XmlResponse(o: Any) = {
val xmlValue = {
@@ -56,7 +57,8 @@ class SwaggerBaseApiController extends Controller {
}
protected def returnValue(request: Request[_], obj: Any): Result = {
- if (returnXml(request)) XmlResponse(obj) else JsonResponse(obj)
+ val response = if (returnXml(request)) XmlResponse(obj) else JsonResponse(obj)
+ response.withHeaders(AccessControlAllowOrigin)
}
protected def JsonResponse(data: Any) = {

No commit comments for this range

Something went wrong with that request. Please try again.