Skip to content

Commit

Permalink
fix conten-type crosscite#98
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 25, 2020
1 parent 2b1e39a commit 76e7cbe
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Mime::Type.register "application/vnd.crosscite.crosscite+json", :crosscite
Mime::Type.register "application/vnd.datacite.datacite+xml", :datacite, %w(application/x-datacite+xml)
Mime::Type.register "application/vnd.datacite.datacite+json", :datacite_json
Mime::Type.register "application/vnd.schemaorg.ld+json", :schema_org, %w(application/ld-json)
Mime::Type.register "application/vnd.schemaorg.ld+json", :schema_org, %w(application/ld+json)
Mime::Type.register "application/vnd.jats+xml", :jats
Mime::Type.register "application/vnd.citationstyles.csl+json", :citeproc, %w(application/citeproc+json)
Mime::Type.register "application/vnd.codemeta.ld+json", :codemeta
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
get '/application/vnd.datacite.datacite+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :datacite_json }
get '/application/vnd.crosscite.crosscite+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :crosscite }
get '/application/vnd.schemaorg.ld+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :schema_org }
get '/application/ld-json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :schema_org }
get '/application/ld+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :schema_org }
get '/application/vnd.codemeta.ld+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :codemeta }
get '/application/vnd.citationstyles.csl+json/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :citeproc }
get '/application/vnd.jats+xml/:id', :to => 'index#show', constraints: { :id => /.+/ }, defaults: { format: :jats }
Expand Down
12 changes: 6 additions & 6 deletions spec/api/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@
end
end

context "application/ld-json" do
context "application/ld+json" do
it "header" do
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/ld-json" }
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/ld+json" }

expect(last_response.status).to eq(200)
response = JSON.parse(last_response.body)
expect(response["@type"]).to eq("BlogPosting")
end

it "link" do
get "/application/ld-json/#{doi}"
get "/application/ld+json/#{doi}"

expect(last_response.status).to eq(200)
response = JSON.parse(last_response.body)
Expand Down Expand Up @@ -412,17 +412,17 @@
end
end

context "application/ld-json" do
context "application/ld+json" do
it "header" do
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/ld-json" }
get "/#{doi}", nil, { "HTTP_ACCEPT" => "application/ld+json" }

expect(last_response.status).to eq(200)
response = JSON.parse(last_response.body)
expect(response["@type"]).to eq("ScholarlyArticle")
end

it "link" do
get "/application/ld-json/#{doi}"
get "/application/ld+json/#{doi}"

expect(last_response.status).to eq(200)
response = JSON.parse(last_response.body)
Expand Down
2 changes: 1 addition & 1 deletion spec/concerns/helpable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"application/vnd.schemaorg.ld+json"=>:schema_org,
"application/vnd.citationstyles.csl+json"=>:citeproc,
"application/citeproc+json"=>:citeproc,
"application/ld-json" => :schema_org,
"application/ld+json" => :schema_org,
"application/vnd.codemeta.ld+json"=>:codemeta,
"application/x-bibtex" => :bibtex,
"application/x-research-info-systems"=>:ris,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 76e7cbe

Please sign in to comment.