Git Product home page Git Product logo

Comments (6)

latentflip avatar latentflip commented on July 3, 2024

Does it really call a success if the error code is 404? In your example the server's responding with a 200, albeit html.

I'm fairly sure if the server were responding with an actual 404 code error would be triggered.

Still a valid question on whether we should be less liberal in accepting random html though. I guess it's hard because servers can sometimes be crappy about responding with html after e.g. a post request.

from ampersand-model.

stephenlacy avatar stephenlacy commented on July 3, 2024

Yes, the error code returned is 200 since it is coming from the SPA endpoint.
It does trigger an error when the http code is 404 (coming directly off the server).

from ampersand-model.

latentflip avatar latentflip commented on July 3, 2024

Okay, well that's good at least :)

In that case this is definitely a tricky one.

from ampersand-model.

stephenlacy avatar stephenlacy commented on July 3, 2024

Indeed.
I am played with the fetch and added a content check: https://github.com/stevelacy/ampersand-fetch-test/blob/master/node_modules/ampersand-model/ampersand-model.js#L59-L68 prototype only of course.

I then added three types of returns, json, html, and no-content.
The results: https://github.com/stevelacy/ampersand-fetch-test/blob/master/sc3.png
204 no content also errors, not sure if that is good behavior.
Thoughts to adding a content-type check option?

from ampersand-model.

stephenlacy avatar stephenlacy commented on July 3, 2024

This also occurs on the collection-rest-mixin in it's fetch function.

from ampersand-model.

stephenlacy avatar stephenlacy commented on July 3, 2024

Closing...

from ampersand-model.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.