Bug in HttpRequestFormPost (General questions)
Modifying form field values after they have been added does not work. See the code modified from your form post example to reproduce the bug:
[code]
wodHttp1.URL = http://www.weonlydo.com/HttpDLX/Demo/TestFormPost.asp
wodHttp1.Request.FormPost.Add Username , anything
wodHttp1.Request.FormPost.Add Password , not joe
' Let us try to change the username
wodHttp1.Request.FormPost( Username ).Value = something else
' Displays Username=something+else&Password=not+joe as expected
MsgBox wodHttp1.Request.FormPost.ToString
' BUG: This still posts Username=anything
wodHttp1.Post
[/code]
Re: Bug in HttpRequestFormPost
Saurabh,
I was able to duplicate your problem - and you're correct. However, I cannot call this a bug, rather it's a feature. wodHttpDLX cannot change FormPost-ed values once they're set, you can only add new ones. So, after they're added, they are read-only.
This is because at the moment you do FormPost.Add, request Body is setup immediately. Changing values later on would require large parsing. It's much more easier - and more efficient if they're only intialy set.
If you think about it - you can easily make workaround this. You could store to be posted values in your own Collection, and then at the moment you would do actual POST call you can add them to FormPost collection - in which case you are always sure they're added correctly.
Re: Bug in HttpRequestFormPost
I would still call it a bug because FormPost(item).Value is writable and when you write to it the changes aren't reflected in the post.
Wouldn't it be better if you contruct the post string once only from the FormPost collection when you are actually ready to post (i.e. in the .Post method) instead of everytime FormPost.Add is called (which is redundant IMO)? This will take care of this bug.
Re: Bug in HttpRequestFormPost
Saurabh,
yes, I agree with you - we could do this. Let me check how easy/hard it would be to fit into current code.
Bad thing is that you wouldn't have access to created Body anymore - some other customers may have liked that option.
Re: Bug in HttpRequestFormPost
Bad thing is that you wouldn't have access to created Body anymore - some other customers may have liked that option.
Isn't the post string always available through the FormPost.ToString method?
Re: Bug in HttpRequestFormPost
Fixed. Behavior isn't changed, but now changing Name or Value property will update body correctly.
Please request update from http://www.weonlydo.com/index.asp?update=1
Re: Bug in HttpRequestFormPost
Works fine now. Thanks for the excellent support :)