hoaproject / Http

The Hoa\Http library.
https://hoa-project.net/
10 stars 9 forks source link

Add JSON support to PUT requests #22

Open 1e1 opened 8 years ago

1e1 commented 8 years ago

If a PUT request is sent with the header "Content-Type: application/json"

the input data will be json_decode as a POST request is decoded. (depends to the '$extended' parameter)

Hywan commented 8 years ago

Is it identical to POST? If yes, we can merge the case in the switch instead.

1e1 commented 8 years ago

It seems correct but it changes the specifications. In the previous version PUT requests never read $_PUT data. And I don't know how work PATCH requests. Can we send data?

Hywan commented 8 years ago

If @Metalaka has not time to be the reviewer, maybe @jubianchi could do the review.

Metalaka commented 8 years ago

@jubianchi Yes, Can you do the review ?

jubianchi commented 8 years ago

I'm on it

jubianchi commented 8 years ago

The code seems ok to me. The rfc5789 does not talk about any restriction on PUT and PATCH request.

They might both have a body with a appropriate content type. Here we handle form-data and json correctly. Everything else is just read from the input and returned. Fine, we have a common solution to handle everything else.

It's a :+1: for me.

1e1 commented 8 years ago

How shall you I process for the second review? I push an amend? I push a new commit? I open another PR?

1e1 commented 8 years ago

@jubianchi ping?

Metalaka commented 8 years ago

@1e1 amend and then force push is good.

1e1 commented 8 years ago

OK. Done.

Hywan commented 8 years ago

@1e1 Your commit title is too long. Either you change it or you're allowing us to change it for you.

@jubianchi Is the PR OK for you?

1e1 commented 8 years ago

@Hywan @all Indeed! I have no computer near me. If title is not changed by then, I will take care of it.

1e1 commented 8 years ago

Done

Hywan commented 8 years ago

Waiting on @jubianchi :-).

Hywan commented 8 years ago

ping?

1e1 commented 8 years ago

up