Commit 90d746e
fix: Handle dict objects in write_resource endpoint
Fixes #412 - 'dict' object has no attribute 'strip' error
The production issue was caused by dict objects being passed to the
write_resource endpoint instead of strings, which then caused
AttributeError when file_utils tried to call .strip() on the content.
Changes:
- resource_router.py: Added defensive type checking to catch dict
inputs early and return helpful 400 error with diagnostic info
- canvas.py: Fixed to use content= parameter with text/plain content
type instead of json= parameter, preventing double-encoding
The canvas tool was using json=canvas_json where canvas_json was
already a JSON string, which could cause encoding issues. The endpoint
expects Body() string content, so we now send it as raw content.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>1 parent 021af74 commit 90d746e
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
154 | 168 | | |
155 | 169 | | |
156 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| |||
0 commit comments