adlnet / lrs-conformance-test-suite

A NodeJS project that tests the MUST requirements of the xAPI Spec and is based on the ADL testing requirements repository. The test suite website can be found here: https://lrstest.adlnet.gov/. The adopters website can be found here: https://adopters.adlnet.gov/
https://adlnet.gov/projects/xapi/
MIT License
67 stars 42 forks source link

xAPI 2.0.0, test failing w/ status 400 but was expected to pass (200) #273

Closed raif-s-naffah closed 1 month ago

raif-s-naffah commented 2 months ago

hi there,

the actual request i'm referring to is the 7th in the series emitted when running version 2.0.0 tests. specifically it's (partly) the following...

"title": "should succeed when attachment is raw data and request content-type is \"multipart/mixed\"",
"name": "should succeed when attachment is raw data and request content-type is \"multipart/mixed\"",
"requirement": "",

"log": "REQUEST SUPERREQUEST
_______________________________________
POST /statements HTTP/1.1\r\nContent-Type: multipart/mixed; boundary=-------314159265358979323846\r\n
X-Experience-API-Version: 2.0.0\r\n
host: localhost:9000\r\n
content-length: 32398\r\n
Connection: keep-alive\r\n\r\n

 ---------314159265358979323846\r\n
Content-Type: application/json\r\n\r\n

{\"actor\":{\"objectType\":\"Agent\",\"name\":\"xAPI account\",\"mbox\":\"mailto:xapi@adlnet.gov\"},\"verb\":{\"id\":\"http://adlnet.gov/expapi/verbs/attended\",\"display\":{\"en-GB\":\"attended\",\"en-US\":\"attended\"}},\"object\":{\"objectType\":\"Activity\",\"id\":\"http://www.example.com/meetings/occurances/34534\"},\"attachments\":[{\"usageType\":\"http://example.com/attachment-usage/test\",\"display\":{\"en-US\":\"A test attachment\"},\"description\":{\"en-US\":\"A test attachment (description)\"},\"contentType\":\"image/jpeg\",\"length\":15770,\"sha2\":\"4d02ef2471928d329c03be883cf0b61f0986a790641210ed8ed2e74c1d75774d\"}]}\r\n
---------314159265358979323846\r\n
Content-Type: image/jpeg\r\n
Content-Transfer-Encoding: binary\r\n
...
"status": "failed",
"error": "Error: Expected response status code to be 200 got 400\nat (/opt/ws-rust/lrs-conformance-test-suite/test/v2_0/4.1.3-Content-Types.js:137:28)"

my implementation is failing this request b/c while the SHA2 hash of the contents does match the declared value, Part #1 actual size (31540) doesn't match declared (15770) value —part #0 being the JSON statement.

pls. note that the full request is 32_398 bytes which seems to supports the 400 Bad Request result.

is this a bug in the test? if not what am i imissing?

thanks in anticipation + cheers; rsn

raif-s-naffah commented 1 month ago

looking closer at the specs, especially the last point in Requirements for Attachment Statement Batches:

Where parameters have a corresponding property within the attachment Object (and both the parameter and property are specified for a given Attachment, the value of these parameters and properties shall match.

i can see that the Part in question does not have a Content-Length header and so the actual size computed by the LRS should not affect the matching process. accordingly, this is not a bug.

closing...