Skip to content

Fixing toJson #4

@0x-r4bbit

Description

@0x-r4bbit

sofa.Util.toJson still handles stupid backend response. Despite from the fact that the backend should be fixed accordingly, it also introduces a side effect as you can see in line 348 https://github.com/sofa/sofa-core/blob/master/src/sofa.util.js#L357-L371.

Any updates on the backend handling?

We should make the toJson method behave like one would expect when using a toJson method. Therefore I would recommend either introducing a separate method that uses toJson and adds the side effect, or introducing a parameter to control wether we want toJson behave like ass or not.

@cburgdorf @nickjanssen thoughts anyone?

Background is that I need this method in sofa.HttpService. Of course, the places where our http service is used only calls our backend, which means calling the current toJson on top of that with the side effect would actually be the right thing.

But to do things "right" we should expect that one can use the http service for other endpoints too!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions