Answer
HTTP vs HTTPS
| Feature | HTTP | HTTPS |
|---|---|---|
| Full form | HyperText Transfer Protocol | HyperText Transfer Protocol Secure |
| URL prefix | http:// | https:// |
| Port | 80 | 443 |
| Security | Unsecured | Secured |
| Layer | Application Layer | Transport Layer (SSL/TLS) |
| Encryption | Absent | Present (SSL/TLS) |
| Certificates | Not required | Requires SSL Certificate |
| Data integrity | Can be tampered | Protected from tampering |
Why HTTPS Matters in API Testing
- ✓Ensures data transmitted between client and server is encrypted
- ✓Prevents man-in-the-middle attacks
- ✓Required for APIs handling sensitive data (auth tokens, passwords, PII)
- ✓Modern APIs should always use HTTPS
Practical Implication in Rest Assured
Java
// HTTPS API call — Rest Assured handles SSL by default
Response response = given()
.relaxedHTTPSValidation() // bypass SSL cert verification in test env
.when()
.get("https://api.example.com/users");
In Interviews
- ✓APIs in production should always use HTTPS
- ✓If testing against a self-signed cert environment, use
relaxedHTTPSValidation() - ✓HTTP is only acceptable in local development
