wvteijlingen / Spine

A Swift library for working with JSON:API APIs. It supports mapping to custom model classes, fetching, advanced querying, linking and persisting.
MIT License
264 stars 109 forks source link

Server does not receive attributes on save() #160

Closed PanagiotisVakalis closed 7 years ago

PanagiotisVakalis commented 7 years ago

I have created a class, which inherits from the Resource class. This class contains Strings, Dates, other resource objects and LinkedResourceCollection objects.

I have created an initialiser for this class using optional values as parameters.

I am trying to POST a resource using:

var resource = ResourceName()
resource.attributeName = "123"

spine.save(resource).onSuccess { (resource) in
       print("Saved")
}.onFailure { (error) in
       dump(error)
}

Although the server gets my request, it does not receive any string containing from the value of the attributeName.

I have copied the JSON which is being created through the debugger and I performed the request through the Postman which did the POST successfully.

wvteijlingen commented 7 years ago

Can you post the resource class?

PanagiotisVakalis commented 7 years ago

I managed to send the attributes. It wasn't a library's problem but a bug on the server and a typo on the content type