Closed niccokunzmann closed 7 years ago
Ich kann jetzt eine valide resource posten und sie wird in die Datenbank geschrieben. TODO:
Fehler General Error: @kremer-io Vielleicht hast du hier Ideen.
{"name":"GeneralError","message":"Not Acceptable","code":500,"className":"general-error","data":{},"errors":{}}
Output:
before all hook ran
create 1
{ userId: 73632d636f6e74656e742d31,
originId: 'cornelsen-physics-2',
providerName: 'none',
description: 'none',
url: 'https://example.org',
title: 'Example Website',
thumbnail: 'http://cache.schul-cloud.org/thumbs/k32164876328764872384.jpg',
mimeType: 'text/html',
licenses: [ 'unknown' ],
contentCategory: 'learning-object' }
create 2
info: after: v1/resources - Method: create
I found the traceback of the error:
at Error.GeneralError (/app/node_modules/feathers-errors/lib/index.js:177:3)
at /app/node_modules/feathers-errors/lib/error-handler.js:25:15
at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:71:5)
at trim_prefix (/app/node_modules/express/lib/router/index.js:315:13)
at /app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
at next (/app/node_modules/express/lib/router/index.js:275:10)
at Layer.handle_error (/app/node_modules/express/lib/router/layer.js:67:12)
at trim_prefix (/app/node_modules/express/lib/router/index.js:315:13)
at /app/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
at next (/app/node_modules/express/lib/router/index.js:275:10)
at ServerResponse.res.format (/app/node_modules/express/lib/response.js:641:5)
at formatter (/app/node_modules/feathers-rest/lib/index.js:25:7)
at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
at next (/app/node_modules/express/lib/router/route.js:137:13)
https://docs.feathersjs.com/api/rest.html There is a link to the formatting
app.configure(rest(function(req, res) {
// Format the message as text/plain
res.format({
'text/plain': function() {
res.end(`The Message is: "${res.data.text}"`);
}
});
}))
Will try this.
a3d55db resolves the error here
{"name":"GeneralError","message":"Not Acceptable","code":500,"className":"general-error","data":{},"errors":{}}
This error is caused because rest can not convert to the media type of the Accept
header.
I would have liked a 406 error but somehow we only get a 500 error.
Now, 12 steps to go and we are done.
adding travis tests....
@kremer-io du kannst mergen.
@niccokunzmann I'll review your PR today
@niccokunzmann atm, this PR is breaking the current implementation. E.g.
GET http://127.0.0.1:4040/resources/
is returning
{
"data": [
{
"id": "x79debcfe",
"type": "id"
}
],
"links": {
"self": "http://127.0.0.1:4040/v1/resources/ids"
},
"jsonapi": {
"version": "1.0",
"meta": {
"name": "schulcloud-content",
"source": "https://github.com/schul-cloud/schulcloud-content",
"description": "This is the content service for storing learning material."
}
}
}
... which can't be right.
Please check the other services, e.g. Client and Server, are still working with this PR.
Then, they must not request using application/vnd.api+json but using application/json. I will check what happens if they request using application/json
If you provide a command you run and the outpt you expect, this speeds up coordination.
I use
curl http://localhost:4040/resources
And I suppose, the test case is that it should not contain "jsonapi".
Yes, curl is fine. Are you not getting the same response as described?
I am getting it.
This should return the correct output:
curl -H "Accept: application/json" http://localhost:4040/resources
This is covered in #36
This adds the resource hook for the version 1 of the resource api for the crawlers.