HTTP interface automation under robotframework Follow response keyword usage

Source: Internet
Author: User
Tags http redirect

The follow Response keyword is used to handle redirection requests in HTTP, and common HTTP REDIRECT requests include HTTP Code 301 and 3,022 redirect requests, which represent a transfer of a URL address.

HTTP Code

Description

301

redirect:301 represents a permanent transfer (permanently Moved).

60W

redirect:302 represents a temporary transfer (temporarily Moved).

Example 1: Call the Blog Park (http://www.cnblogs.com/) authentication Interface (https://passport.cnblogs.com/user/signin) for user login authentication, no cookie set on request HTTP code returns 302 when the HTTP header is used, and continues the request with the redirected URL after using the follow Response keyword.

Create Http Context passport.cnblogs.com Scheme=https

Set Request Header Referer https://passport.cnblogs.com/user/signin?ReturnUrl=http://i.cnblogs.com/

Set Request Body {"input1": "v+boqyku0zqxtauwxpgzc4yvvxwli6/za9u6hx2jxxdzipdxt2fzravj7air5ydssqeukyzfnb+ Komrnfzf5dzbhxn3foxhdq5oromddhh/zdxtuuqg/9ev4v4yyt9t8v9felmxs+bvrf2knzu35vtkaftqw8qn08tl0ggdzezy= "," Input2 ":" gak4vtm2i+a/6blhriu8/oeekjkav3sru/ds5l3o0bmd/xk6ped0vk8guls6/obv3dl+y8hub2ey9+ Po6ip53kisnkpoeu1y0p0acixmgk0jwcs+ydclgen0krvxnlo/ltcw1hrxvcrbraahrcezdt2otbye4frzkimshhqz+se= "," Remember ": False

Post/user/signin

Follow Response

${status} Get Response Status

${body} Get Response Body

Log ${body}

Log ${status}

Execution Result:

From the returned results, after the follow response keyword is used, the redirected URL continues with the request, and the last HTTP code returned is 200.

HTTP interface automation under robotframework Follow response keyword usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.