Suportar unmarshalling
Reported by Guilherme Silveira | October 25th, 2010 @ 09:34 AM
r = Restfulie.at(...).accepts(type).get
cliente = r.resource
Ao chamar accepts(type), o header Accept vai com type.
Ao receber o resultado de QUALQUER tipo de requisicao, devemos
disponibilizar o metodo resource.
Ao invocar o metodo resource, veja o header "Content-type" da
RESPONSE e pegue o converter adequado, unmarshalleando:
def resource
converter = marshallers[headers["Content-type"]]
converter.unmarshal(body) end
Comments and changes to this ticket
-
Guilherme Silveira November 16th, 2010 @ 09:27 AM
- Assigned user set to Alexandre Atoji
Esse eh o caminho inverso do enviar dados, eh o de receber.
Isto eh, ao falar o accepts, eu estou falando o media type que eu aceito entaou m header deve ser adicionado.Ai em qualquer requisicao, ao receber o resultado, ele deve ter um metodo chamado resource que deserializa ele (como o codigo acima)
-
Alexandre Atoji December 21st, 2010 @ 12:24 PM
- State changed from new to resolved
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
A python version of restfulie