File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -225,8 +225,8 @@ httpGet = do
225
225
JSON req <- input
226
226
-- Send the request, get a 'Response'
227
227
res <- sendRequest req (Nothing :: Maybe String )
228
- -- Save response body to memory
229
- outputMemory (memory res)
228
+ -- Save response body to output
229
+ output $ responseData res
230
230
-- Return code
231
231
return 0
232
232
@@ -248,6 +248,8 @@ to do this correctly. So we recommend reading out [concept doc on Host Functions
248
248
Host functions in the Haskell PDK require C stubs to import a function from a particular namespace:
249
249
250
250
```c
251
+ #include <stdint.h>
252
+
251
253
#define IMPORT(a, b) __attribute__((import_module(a), import_name(b)))
252
254
IMPORT (" extism:host/user" , " a_python_func" )
253
255
uint64_t a_python_func_impl(uint64_t input);
@@ -270,8 +272,9 @@ foreign import ccall "a_python_func" aPythonFunc :: Word64 -> IO Word64
270
272
helloFromPython :: String -> IO String
271
273
helloFromPython = do
272
274
s' <- allocString " Hello!"
273
- res <- aPythonFunc (memoryOffset s')
274
- logInfo <$> loadString res
275
+ resOffset <- aPythonFunc (memoryOffset s')
276
+ resMem <- findMemory resOffset
277
+ logInfo =<< loadString resMem
275
278
return 0
276
279
277
280
foreign export ccall " helloFromPython" helloFromPython :: IO Int32
You can’t perform that action at this time.
0 commit comments