Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a reponse with an empty entity gets nil as entity on sending #entity to ZnClient instance #13

Closed
fortizpenaloza opened this issue Dec 10, 2014 · 1 comment

Comments

@fortizpenaloza
Copy link
Contributor

Using Zinc-REST package i tried to create a empty response like this:

ZnJSONRestCall#empyResponse

     entity := ZnEntity with: String new type: ZnMimeType applicationJson.
     ^ response := ZnResponse ok: entity

The code using it is similar to ZnExampleStorageObjectRestCall#put method.

So on a test i've this collaborations

     ...
client
    addPathSegment: '1';
    contents: data;
    put.

self assert: client isSuccess.
self assert: client entity isEmpty.
self assert: client response contentLength equals: 0.

But client entity isEmpty fails because entity is nil instead of a empty entity.

Is this the expeted behavior?

@svenvc
Copy link
Owner

svenvc commented Dec 10, 2014

That is an optimalization: when the response is of 0 length no ZnEntity object is created. There is also #hasEntity

@svenvc svenvc closed this as completed Oct 20, 2017
svenvc added a commit that referenced this issue May 30, 2024
Update to latest upstream Zinc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants