[flexcoders] Re: Construct simple http request header
Not quite - When I inspect the request, this approach results in application/x-www-form-urlencoded parms of name=foovalue=bar What I'm looking for is headers in the http request, headers like: ... Keep-Alive: 300 Connectin: keep-alive Referer: to name but a few. The 'headers' attribute of the httpService appears to be the right spot, I'm just without a way to specify. I'll try a combo of the object build and headers use.. All pgm suggestions / ideas are welcome. Thanks --- In flexcoders@yahoogroups.com, Guilherme Blanco [EMAIL PROTECTED] wrote: var params:Object = new Object(); params.name = foo; params.value = bar; service.send(params); Cheers, On Wed, Jul 23, 2008 at 5:04 PM, ron_mori [EMAIL PROTECTED] wrote: How to add headers to httpService request? Goal - add request header name:val of 'foo: bar' Tried: var hdr:Array = [{name:foo, value:bar}]; Header has: [object object] Tried: var hdr:Array = [foo, bar]; Header has: [0]:foo, [1]:bar ideas? thanks in advance. -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: [EMAIL PROTECTED] URL: http://blog.bisna.com Rio de Janeiro - RJ/Brazil
[flexcoders] Re: Construct simple http request header
Tracy, Thanks - it worked beautifully. For the records: httpService.headers = {'foo':'bar'}; Now, not to seem ungrateful, I need to add two headers. Suggestions? An array resulted in object: object --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: I believe that will send the object in the body of the post, not in the header. From a post in the archives, you need to do somethng like: httpService. headers = {customHeader: 'foobar'}; Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guilherme Blanco Sent: Wednesday, July 23, 2008 4:08 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Construct simple http request header var params:Object = new Object(); params.name = foo; params.value = bar; service.send(params); Cheers, On Wed, Jul 23, 2008 at 5:04 PM, ron_mori [EMAIL PROTECTED] mailto:ron_mori%40yahoo.com wrote: How to add headers to httpService request? Goal - add request header name:val of 'foo: bar' Tried: var hdr:Array = [{name:foo, value:bar}]; Header has: [object object] Tried: var hdr:Array = [foo, bar]; Header has: [0]:foo, [1]:bar ideas? thanks in advance. -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: [EMAIL PROTECTED] mailto:guilhermeblanco%40hotmail.com URL: http://blog.bisna.com http://blog.bisna.com Rio de Janeiro - RJ/Brazil
RE: [flexcoders] Re: Construct simple http request header
Stick with the object, which is essentially a set of name=value pairs: httpService.headers = {foo:'bar', boo:'baz'}; Note, do not quote the name of the property. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ron_mori Sent: Wednesday, July 23, 2008 5:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Construct simple http request header Tracy, Thanks - it worked beautifully. For the records: httpService.headers = {'foo':'bar'}; Now, not to seem ungrateful, I need to add two headers. Suggestions? An array resulted in object: object --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt [EMAIL PROTECTED] wrote: I believe that will send the object in the body of the post, not in the header. From a post in the archives, you need to do somethng like: httpService. headers = {customHeader: 'foobar'}; Tracy From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Guilherme Blanco Sent: Wednesday, July 23, 2008 4:08 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Construct simple http request header var params:Object = new Object(); params.name = foo; params.value = bar; service.send(params); Cheers, On Wed, Jul 23, 2008 at 5:04 PM, ron_mori [EMAIL PROTECTED] mailto:ron_mori%40yahoo.com wrote: How to add headers to httpService request? Goal - add request header name:val of 'foo: bar' Tried: var hdr:Array = [{name:foo, value:bar}]; Header has: [object object] Tried: var hdr:Array = [foo, bar]; Header has: [0]:foo, [1]:bar ideas? thanks in advance. -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: [EMAIL PROTECTED] mailto:guilhermeblanco%40hotmail.com URL: http://blog.bisna.com http://blog.bisna.com http://blog.bisna.com http://blog.bisna.com Rio de Janeiro - RJ/Brazil
RE: [flexcoders] Re: Construct simple http request header
Also, the {name1:value1, name2:value2} syntax is the equivalent (but slightly more efficient form) of: var oHeaders:Object = new Object(); oHeaders.foo = 'bar'; oHeaders.boo = 'baz'; httpService.headers = oHeaders; Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Wednesday, July 23, 2008 6:19 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Construct simple http request header Stick with the object, which is essentially a set of name=value pairs: httpService.headers = {foo:'bar', boo:'baz'}; Note, do not quote the name of the property. Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of ron_mori Sent: Wednesday, July 23, 2008 5:12 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Construct simple http request header Tracy, Thanks - it worked beautifully. For the records: httpService.headers = {'foo':'bar'}; Now, not to seem ungrateful, I need to add two headers. Suggestions? An array resulted in object: object --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Tracy Spratt [EMAIL PROTECTED] wrote: I believe that will send the object in the body of the post, not in the header. From a post in the archives, you need to do somethng like: httpService. headers = {customHeader: 'foobar'}; Tracy From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com ] On Behalf Of Guilherme Blanco Sent: Wednesday, July 23, 2008 4:08 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: Re: [flexcoders] Construct simple http request header var params:Object = new Object(); params.name = foo; params.value = bar; service.send(params); Cheers, On Wed, Jul 23, 2008 at 5:04 PM, ron_mori [EMAIL PROTECTED] mailto:ron_mori%40yahoo.com wrote: How to add headers to httpService request? Goal - add request header name:val of 'foo: bar' Tried: var hdr:Array = [{name:foo, value:bar}]; Header has: [object object] Tried: var hdr:Array = [foo, bar]; Header has: [0]:foo, [1]:bar ideas? thanks in advance. -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: [EMAIL PROTECTED] mailto:guilhermeblanco%40hotmail.com URL: http://blog.bisna.com http://blog.bisna.com http://blog.bisna.com http://blog.bisna.com Rio de Janeiro - RJ/Brazil
[flexcoders] Re: Construct simple http request header
Forgive my impatience - allow me to answer my own question. After some work, the answer is: httpService.headers = { 'foo':'bar', 'foo2': 'bar2' }; Thanks again for the help. --- In flexcoders@yahoogroups.com, ron_mori [EMAIL PROTECTED] wrote: Tracy, Thanks - it worked beautifully. For the records: httpService.headers = {'foo':'bar'}; Now, not to seem ungrateful, I need to add two headers. Suggestions? An array resulted in object: object --- In flexcoders@yahoogroups.com, Tracy Spratt tspratt@ wrote: I believe that will send the object in the body of the post, not in the header. From a post in the archives, you need to do somethng like: httpService. headers = {customHeader: 'foobar'}; Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Guilherme Blanco Sent: Wednesday, July 23, 2008 4:08 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Construct simple http request header var params:Object = new Object(); params.name = foo; params.value = bar; service.send(params); Cheers, On Wed, Jul 23, 2008 at 5:04 PM, ron_mori ron_mori@ mailto:ron_mori%40yahoo.com wrote: How to add headers to httpService request? Goal - add request header name:val of 'foo: bar' Tried: var hdr:Array = [{name:foo, value:bar}]; Header has: [object object] Tried: var hdr:Array = [foo, bar]; Header has: [0]:foo, [1]:bar ideas? thanks in advance. -- Guilherme Blanco - Web Developer CBC - Certified Bindows Consultant Cell Phone: +55 (16) 9166-6902 MSN: guilhermeblanco@ mailto:guilhermeblanco%40hotmail.com URL: http://blog.bisna.com http://blog.bisna.com Rio de Janeiro - RJ/Brazil