@@ -58,8 +58,8 @@ def response(header)
58
58
59
59
it "handles successful response with plain header" do
60
60
expect ( subject ) . to receive ( :request ) . and_yield response ( 'text/plain' )
61
- expect ( RDF ::Reader ) . to receive ( :for ) . with ( content_type : 'text/plain ' ) . and_call_original
62
- subject . query ( query )
61
+ expect ( RDF ::Reader ) . to receive ( :for ) . with ( content_type : 'application/n-triples ' ) . and_call_original
62
+ subject . query ( query , content_type : 'application/n-triples' )
63
63
end
64
64
65
65
it "handles successful response with boolean header" do
@@ -109,17 +109,17 @@ def response(header)
109
109
end
110
110
111
111
it "handles successful response with custom headers" do
112
- expect ( subject ) . to receive ( :request ) . with ( anything , { "Authorization" => "Basic XXX==" } ) .
113
- and_yield response ( 'text/plain ' )
114
- subject . query ( query , headers : { "Authorization" => "Basic XXX==" } )
112
+ expect ( subject ) . to receive ( :request ) . with ( anything , { "Authorization" => "Basic XXX==" , "Content-Type" => "application/n-triples" } ) .
113
+ and_yield response ( 'application/n-triples ' )
114
+ subject . query ( query , headers : { "Authorization" => "Basic XXX==" , "Content-Type" => "application/n-triples" } )
115
115
end
116
116
117
117
it "handles successful response with initial custom headers" do
118
118
options = { headers : { "Authorization" => "Basic XXX==" } , method : :get }
119
119
client = SPARQL ::Client . new ( 'http://data.linkedmdb.org/sparql' , **options )
120
- client . instance_variable_set :@http , double ( request : response ( 'text/plain ' ) )
120
+ client . instance_variable_set :@http , double ( request : response ( 'application/n-triples ' ) )
121
121
expect ( Net ::HTTP ::Get ) . to receive ( :new ) . with ( anything , hash_including ( options [ :headers ] ) )
122
- client . query ( query )
122
+ client . query ( query , content_type : 'application/n-triples' )
123
123
end
124
124
125
125
it "enables overriding the http method" do
@@ -194,15 +194,15 @@ def response(header)
194
194
to_return ( body : '' , status : 200 , headers : { 'Content-Type' => 'application/n-triples' } )
195
195
subject . query ( construct_query )
196
196
expect ( WebMock ) . to have_requested ( :post , "http://data.linkedmdb.org/sparql" ) .
197
- with ( headers : { 'Accept' => 'application/n-triples, text/plain, */*;q=0.1' } )
197
+ with ( headers : { 'Accept' => 'application/n-triples, */*;q=0.1' } )
198
198
end
199
199
200
200
it "uses application/n-triples for DESCRIBE" do
201
201
WebMock . stub_request ( :any , 'http://data.linkedmdb.org/sparql' ) .
202
202
to_return ( body : '' , status : 200 , headers : { 'Content-Type' => 'application/n-triples' } )
203
203
subject . query ( describe_query )
204
204
expect ( WebMock ) . to have_requested ( :post , "http://data.linkedmdb.org/sparql" ) .
205
- with ( headers : { 'Accept' => 'application/n-triples, text/plain, */*;q=0.1' } )
205
+ with ( headers : { 'Accept' => 'application/n-triples, */*;q=0.1' } )
206
206
end
207
207
208
208
it "uses application/sparql-results+json for SELECT" do
0 commit comments