[moriarty] r326 committed - fixed accept header in simplegraph::read_data

0 views
Skip to first unread message

mori...@googlecode.com

unread,
Oct 31, 2011, 12:25:19 PM10/31/11
to moriarty...@googlegroups.com
Revision: 326
Author: k.j.w.a...@gmail.com
Date: Mon Oct 31 09:24:47 2011
Log: fixed accept header in simplegraph::read_data
http://code.google.com/p/moriarty/source/detail?r=326

Modified:
/trunk/graph.class.php
/trunk/simplegraph.class.php
/trunk/tests/simplegraph.test.php

=======================================
--- /trunk/graph.class.php Fri Sep 9 16:09:37 2011
+++ /trunk/graph.class.php Mon Oct 31 09:24:47 2011
@@ -162,7 +162,7 @@
$response = $this->submit_turtle($batch);
$responses[] = $response;
if(is_callable($callback)){
- call_user_func($callback, $response);
+ call_user_func_array($callback, array($response, $batch));
} else if($response->is_success()===false){
return $responses;
}
=======================================
--- /trunk/simplegraph.class.php Thu Sep 29 03:36:55 2011
+++ /trunk/simplegraph.class.php Mon Oct 31 09:24:47 2011
@@ -1317,7 +1317,7 @@
$requests = array();
foreach ($uri_list as $uri) {
$request = $this->request_factory->make( 'GET', $uri );
- $request->set_accept('application/json, text/turtle, text/n3,
text/rdf+n3, application/x-turtle,
application/rdf+xml;q=0.8,application/xml;q=0.6, */*');
+ $request->set_accept('application/json, text/turtle, text/n3,
text/rdf+n3, application/x-turtle,
application/rdf+xml;q=0.8,application/xml;q=0.6, */*;q=0.5');
$request->execute_async();
$requests[] = $request;
}
@@ -1341,7 +1341,10 @@
}
else if (
strpos($response->headers['content-type'], 'application/json') === 0) {
$this->add_json($response->body);
- }
+ } else {
+ $this->add_rdf($response->body);
+ }
+
}
}
}
=======================================
--- /trunk/tests/simplegraph.test.php Tue Aug 2 08:53:06 2011
+++ /trunk/tests/simplegraph.test.php Mon Oct 31 09:24:47 2011
@@ -941,7 +941,7 @@
$g->set_request_factory($fake_request_factory);
$g->read_data('http://example.org/thing');

- $this->assertTrue( in_array('Accept: application/json, text/turtle,
text/n3, text/rdf+n3, application/x-turtle,
application/rdf+xml;q=0.8,application/xml;q=0.6, */*',
$fake_request->get_headers() ) );
+ $this->assertTrue( in_array('Accept: application/json, text/turtle,
text/n3, text/rdf+n3, application/x-turtle,
application/rdf+xml;q=0.8,application/xml;q=0.6, */*;q=0.5',
$fake_request->get_headers() ) );
}

function test_read_data_parses_application_rdfxml() {

Reply all
Reply to author
Forward
0 new messages