diff options
author | bptato <nincsnevem662@gmail.com> | 2023-04-30 20:32:05 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-04-30 20:32:05 +0200 |
commit | 5697627af260aba5c44ef3156dd0b1d53229f8e0 (patch) | |
tree | e55a80940fd2dc198a62477a95a3d8bfbef4803e /src | |
parent | 15fe78e9ffec7818a44838d71e99b4355374819d (diff) | |
download | chawan-5697627af260aba5c44ef3156dd0b1d53229f8e0.tar.gz |
only call Response.unregisterFun if not nil
Diffstat (limited to 'src')
-rw-r--r-- | src/io/request.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/io/request.nim b/src/io/request.nim index d61a19fa..72631bed 100644 --- a/src/io/request.nim +++ b/src/io/request.nim @@ -216,7 +216,8 @@ proc text*(response: Response): string {.jsfunc.} = result = response.body.readAll() response.body.close() response.bodyUsed = true - response.unregisterFun() + if response.unregisterFun != nil: + response.unregisterFun() #TODO: get rid of this proc readAll*(response: Response): string {.jsfunc.} = @@ -235,7 +236,8 @@ proc close*(response: Response) {.jsfunc.} = #TODO: this looks pretty unsafe response.body.close() response.bodyUsed = true - response.unregisterFun() + if response.unregisterFun != nil: + response.unregisterFun() func credentialsMode*(attribute: CORSAttribute): CredentialsMode = case attribute |