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

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

Closed
oscarr-reyes opened this issue Jul 31, 2016 · 2 comments
Assignees

Comments

@oscarr-reyes
Copy link

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
@adamhalasz adamhalasz self-assigned this Aug 23, 2016
@frank-dspeed
Copy link
Contributor

frank-dspeed commented Oct 19, 2016

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.

adamhalasz added a commit that referenced this issue Mar 2, 2017
- Introducing signal.setHeader(key, value) to set a response header #61
- Introducing signal.getHeader(key) to return a response header #61
- Introducing signal.getRequestHeader(key) to return a request header
#61
- Introducing signal.error(key) to return an error with a key #61
- Introducing signal.sendFile(path) to end a response with a file #69
- Introducing $.error('message') and $.error('stack') to allow better
Error Exceptions handling with app.error(callback)
- Added example for signal.error
- Added example for signal.sendFile
@adamhalasz
Copy link
Owner

adamhalasz commented Mar 2, 2017

@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.

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

3 participants