~ fix a bug in conneg (was reacting on content-type instead of Accept)
authorAlexandre Bertails <bertails@w3.org>
Mon, 29 Aug 2011 17:53:10 -0400
changeset 29 1384dd35dc68
parent 28 2baaeecfbe43
child 30 c468ac3dd7de
~ fix a bug in conneg (was reacting on content-type instead of Accept)
src/main/scala/Main.scala
src/main/scala/util.scala
src/test/scala/Test.scala
--- a/src/main/scala/Main.scala	Mon Aug 29 17:43:53 2011 -0400
+++ b/src/main/scala/Main.scala	Mon Aug 29 17:53:10 2011 -0400
@@ -143,7 +143,7 @@
       System.exit(2)
     }
 
-    val filesystem = new Filesystem(baseDirectory, baseURL)(mode)
+    val filesystem = new Filesystem(baseDirectory, baseURL, lang="TURTLE")(mode)
     
     val app = new ReadWriteWeb(filesystem)
 
--- a/src/main/scala/util.scala	Mon Aug 29 17:43:53 2011 -0400
+++ b/src/main/scala/util.scala	Mon Aug 29 17:53:10 2011 -0400
@@ -37,7 +37,7 @@
     }
     
   def apply(req:HttpRequest[_]):RDFEncoding = {
-    val contentType = RequestContentType(req)
+    val contentType = Accept(req).headOption
     contentType map { RDFEncoding(_) } getOrElse RDFXML
   }
   
--- a/src/test/scala/Test.scala	Mon Aug 29 17:43:53 2011 -0400
+++ b/src/test/scala/Test.scala	Mon Aug 29 17:53:10 2011 -0400
@@ -101,7 +101,7 @@
   "a GET on Joe's URI" should {
     "deliver TURTLE and RDF/XML graphs that are isomorphic to each other" in {
       val rdfxml = Http(joe as_model(joeBaseURI))
-      val turtle = Http(joe <:< Map("Content-type" -> "text/turtle") as_model(joeBaseURI, lang="TURTLE"))
+      val turtle = Http(joe <:< Map("Accept" -> "text/turtle") as_model(joeBaseURI, lang="TURTLE"))
       rdfxml must beIsomorphicWith(turtle)
     }
   }