DevForge
2

Implement ECHO command

Build Redis from scratch

1 hour
Level 2 of 4

Add support for the ECHO command that returns the provided message

Objectives
Complete these objectives to finish this level
  • Parse ECHO command with arguments
  • Return the echoed message in RESP format
  • Handle edge cases like empty messages
Test Cases
Your implementation should pass these tests
  • ECHO hello returns hello
  • ECHO with spaces works
  • Empty ECHO handled gracefully
Hints
  • 💡 ECHO takes one argument
  • 💡 Response format: $<length>\r\n<message>\r\n
  • 💡 Handle UTF-8 encoding properly
Challenge Progress
Level 2 of 450%