Add Postman Collection import command#4
Conversation
Adds `apicli import postman <file>` to load a Postman Collection v2.0/v2.1 JSON file and save all its requests as an apicli collection. Key details: - Handles both URL formats: plain string and structured object - Recursively flattens nested folders using "Folder / Request" prefixes - Appends to an existing collection if the name already exists - --collection flag overrides the Postman collection name as the target - Skips non-raw body modes (form-data, urlencoded) gracefully https://claude.ai/code/session_01PyL8EW4HoiuaCszqviyfGt
Code Review: Add Postman Collection import commandOverall this is a solid implementation. The polymorphic URL handling with Bug: Disabled headers are imported as active
// Current
type postmanHeader struct {
Key string `json:"key"`
Value string `json:"value"`
}
// Should be
type postmanHeader struct {
Key string `json:"key"`
Value string `json:"value"`
Disabled bool `json:"disabled"`
}
// And in convertPostmanRequest:
for _, h := range pr.Header {
if h.Key != "" && !h.Disabled {
headers[h.Key] = h.Value
}
}Performance: One transaction per request
Minor: Query params dropped in URL reconstruction fallbackIn // port and query params are both missing from the fallback
return fmt.Sprintf("%s://%s%s", scheme, host, path)In practice Postman always populates Minor: Misleading
|
Adds
apicli import postman <file>to load a Postman Collection v2.0/v2.1 JSON file and save all its requests as an apicli collection.Key details:
https://claude.ai/code/session_01PyL8EW4HoiuaCszqviyfGt