3.4Method Naming Conventions
Created on Aug 17, 2026~3 min read
When designing the methods of the HttpRequestBuilder object, we follow a clear set of naming conventions to ensure that each method's functionality and behavior are intuitive and easy to understand. Specifically, all methods that can only perform an operation start with Set or Use, while all methods that support repeated invocation and additive operations start with With or Add.
- Methods starting with
SetorUse: these methods are used to set a property or parameter; if called repeatedly, the later call overrides the previous setting. For example, for theSetTraceIdentifier(traceId)method, when called multiple times, only thetraceIdfrom the last call takes effect. - Methods starting with
WithorAdd: these methods are used to add or modify certain content and support repeated invocation. When called repeatedly, they do not override previous settings but accumulate instead. For example, theWithHeader(key, value)method, when called multiple times, preserves all previous header information and adds new header information.
This naming convention makes the methods of the HttpRequestBuilder object clearer and easier to understand, helping developers quickly grasp the functionality and behavior of each method.