Node 0.10.5 (but should work with 0.8.X too) express 3
i took your code

Am Freitag, 17. Mai 2013 07:19:10 UTC+2 schrieb Rams B:
>
> Hi 
>
> Thanks for your reply.
>
> I updated my express version to 3.2.4. and my nodejs version is 0.8.11.
> I tried now, even I couldn't.
>
> May I know which version of nodejs and express you are using.
>
> Can you share the example codes which you tried.
>
> Ramesh 
>
> On Thursday, 16 May 2013 18:18:35 UTC+5:30, greelgorke wrote:
>>
>> i trieyd out, it works for me:
>>
>>     console.log("emp_value:"+request.headers['custom_header']);  *//**
>> emp_value:head_val*
>>
>> Am Donnerstag, 16. Mai 2013 12:33:19 UTC+2 schrieb Rams B:
>>>
>>> Hi All,
>>>
>>> I am trying sending some Custom Headers from Client to Server. The 
>>> following ajax call is capable to send header information to server.
>>>
>>> *Client AJAX Call:*
>>> $.ajax({
>>>       type: "GET",
>>>       url: "ws_url",
>>>       dataType: "jsonp",
>>>        headers:{
>>>             "custom_header":"head_val"
>>>       },
>>>       success: function(data) {
>>>           alert(data)
>>>       }
>>> });
>>>
>>> With above ajax call, I can get the header information at server end 
>>> using JAVA based Apache CXF Web Services like below:
>>> String client_custom_header = 
>>> HttpHeaders.getRequestHeaders().getFirst("custome_header");
>>> //I am getting the header value "head_val".
>>>
>>> If I am trying to implement same thing in node.js with express frame 
>>> work; I cannot read the headers info.
>>> *
>>> Please find my node.js code:*
>>> var https = require('http');
>>> var express = require('express')
>>> var app = express.createServer();
>>>
>>> var allowCrossDomain = function(req, res, next) {
>>>     res.header('Access-Control-Allow-Origin', '*');
>>>     res.header('Access-Control-Allow-Methods', 
>>> 'GET,PUT,POST,DELETE,OPTIONS');
>>>     res.header('Access-Control-Allow-Headers', 'Content-Type, 
>>> Authorization, Content-Length, X-Requested-With');
>>> };
>>>
>>> app.configure(function () {
>>>   app.use(express.bodyParser());
>>>   app.use(express.methodOverride());
>>>   app.use(app.router);
>>>  // app.use(allowCrossDomain);
>>>   app.use(express.errorHandler({ dumpExceptions: true, showStack: true 
>>> }));
>>> });
>>> app.get('/getData', function(request, response){
>>>   
>>>     console.log('STATUS: ' + 
>>> response.getHeader('custom_header'));//undefined
>>>
>>>     console.log('HEADERS: ' + 
>>> JSON.stringify(response.headers));//undefined
>>>       
>>>     console.log("emp_value:"+request.headers['custom_header']);  
>>> //undefined
>>>
>>>     console.log("\n\n*****111*******"+request.body); //undefined
>>>       
>>>     console.log('params: ' + JSON.stringify(request.params));//[]
>>>
>>>     console.log('header: ' +  
>>> JSON.stringify(request.header("Access-Control-Allow-Origin", "*")));//"*"
>>>
>>>     console.log('body: ' + JSON.stringify(request.body));//undefined
>>>
>>>     console.log('query: ' + JSON.stringify(request.query));//{"d":"20"}
>>>
>>>     console.log('query: ' + request.query.d);//20
>>>     
>>> });
>>> app.listen(8889);
>>>
>>> ---------------------------------------------------------
>>>
>>> I tried several options but I couldn't. Please help me soon.........
>>>
>>> Thanks in advance..
>>>
>>> Ramesh
>>>
>>>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to