http status ?

Asked by joe on 2016-07-21

working on test adapter project
i need to know the function that can get the <HTTP STATUS VALUE>
HTTP/1.1 200 OK <---the value if its 200 or so
pls tks

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
2016-07-21
Last reply:
2016-07-21

This question was reopened

  • 2016-07-21 by joe
joe (joejoe) said : #1

tks any way i found out how :)
statusLine = dynamic_cast<libecap::StatusLine*>(firstLine);
if (statusLine->statusCode() != 200)

joe (joejoe) said : #2

tks to the help by reading in this forum and tks alex :)

Alex Rousskov (rousskov) said : #3

Note that dynamic_cast might result in a nil pointer so you should check statusLine before dereferencing it.

joe (joejoe) said : #4

is this will do
if ((statusLine != NULL) {
   if (statusLine->statusCode() != 200) {
    //do my code here
  }
}

is there other way to chk the status value or its the only way

Alex Rousskov (rousskov) said : #5

Yes, comparing statusLine with NULL will protect you from dereferencing a nil pointer.

> is there other way to chk the status value or its the only way

The StatusLine::statusCode() method is the only way.

joe (joejoe) said : #6

the reason i ask about the status code cause i got error in header so tough to filter out non 200 status
my code work well but i still got the error its not my code or the adaper

if you want alex i post here or if you want me to open another issue ???

Alex Rousskov (rousskov) said : #7

> i got error in header so tough to filter out non 200 status

Sorry, I do not understand what you mean.

> if you want alex i post here or if you want me to open another issue ???

One question per Question, please.

Can you help with this problem?

Provide an answer of your own, or ask joe for more information if necessary.

To post a message you must log in.