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

InvalidURL: nonnumeric port: '//host' #15

Open
chy168 opened this issue Feb 26, 2013 · 5 comments
Open

InvalidURL: nonnumeric port: '//host' #15

chy168 opened this issue Feb 26, 2013 · 5 comments

Comments

@chy168
Copy link
Contributor

chy168 commented Feb 26, 2013

Hi,
I would like to use POST keyword to send my data.
I use a simple way to verify the HTTP request.

# nc -l 0.0.0.0 80
*** Settings ***
Documentation     This is TestService API Library
Library           HttpLibrary.HTTP

*** Variables ***
# https://service.test/TestService/GetLicense
${api_host}       service.test

*** Keywords ***
Init TestService Environment
    Create Http Context    service.test    http
    Set Request Header    Content-Type    application/xml
    Set Request Header    Accept    */*

Invoke TestService API GetLicense
    [Arguments]    ${query_string}
    Init TestService Environment

    Set Request Body    TEST_HELLO
    Set Request Header    Content-Type    application/xml
    Set Request Header    Accept    */*
    # Set Request Body    ${query_string}
    POST    http://service.test/TestService/GetLicense

    Log Response Body
    ${response_body}    Get Response Body
    [Return]    ${response_body}

We can see in "HttpLibrary.HTTP.Set Request Body", it shows "Request body set to TEST_HELLO".
But in "HttpLibrary.HTTP.POST", i got "No request body set".

Screen Shot 2013-02-26 at 12 43 17 PM

My test server got,

Screen Shot 2013-02-26 at 12 47 25 PM

Do I misunderstand something ? Thanks! :)
Thanks!

@peritus
Copy link
Owner

peritus commented Feb 26, 2013

This is a duplicate of #10 (read about the details there). Basically you need to change

-POST    http://service.test/TestService/GetLicense
+POST    /TestService/GetLicense

in your test.

I'll definitely need to look into #10 , as this is really confusing.

@peritus peritus closed this as completed Feb 26, 2013
@peritus
Copy link
Owner

peritus commented Feb 26, 2013

Also, thanks for the superb bug report!

@chy168
Copy link
Contributor Author

chy168 commented Feb 26, 2013

thanks you very much! i will check it out!

@chy168
Copy link
Contributor Author

chy168 commented Feb 26, 2013

Hi @peritus

I might some confuse in create context.
As your suggestion and #10 , i update some code base on my previous post as below.

- Create Http Context    service.test    http
+ Create Http Context    http://service.test
- POST    http://service.test/TestService/GetLicense
+ POST    /TestService/GetLicense

But it will case a error "InvalidURL: nonnumeric port: '//service.test'"

Screen Shot 2013-02-26 at 3 36 26 PM

After some investigation, i updated my test case by

Create Http Context    service.test  http
POST  /TestService/GetLicense

I'm not sure if there are different behaviour by different URI input? if not please correct me.
Thank you!

@peritus
Copy link
Owner

peritus commented Feb 26, 2013

Glad you got it working!

No, your two alternative invocations of Create Http Context should be equivalent. I'll keep this open to add tests that resemble the edge cases you uncovered, so the next person won't be as confused ;) Thank you!

@peritus peritus reopened this Feb 26, 2013
@ghost ghost assigned peritus Feb 26, 2013
@peritus peritus removed their assignment Jun 11, 2014
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

2 participants