adamhalasz/diet

Suggestion: rename signal properties for better readability on request and response

oscarr-reyes opened this issue · 2 comments

I am sure it happens on many developers (specially when they are trying for the first time this framework) that some signal properties have the same name for request and response.. i would suggest to change the names of these properties like this

For Request:
$.header() => $.getHeader()
$.headers() => $.getHeaders()

for Response:
$.header() => $.setHeader()     //Specially this property cause it's also available for request
$.headers() => $.setHeaders()  //I thought on this one to just pass an object as parameter

nope we should make it the following if it is not this way at present:

We use so called lazzy setter getters that means;

$.headers() -> returns the headers its a getter
$.headers('headname') -> returns the single header its a getter
$.headers([headname1,headname2]) -> returns the 2 headers its a getter it got a single arrgument array could be also single arrgument object.
$.headers('headername', value) -> will set the headername to value same with arrays and objects sorry i dont write whole documentation here. 

greetings.

@Nosthertus As of v0.12.0 you can use $.getHeader(key), $.setHeader(key, value) to return response headers and $.getRequestHeader(key) to return request headers.

As far as I know you cannot SET request headers because they come from the client.

Also you could and still can access all request headers with the $.headers object.