<% '########################################################################################### 'api 호출 바디 구하기 'return : string '########################################################################################### Function ReadRequestBodySafe() Dim ctype : ctype = LCase(Request.ServerVariables("CONTENT_TYPE")) Dim body : body = "" ' JSON/XML/Text 류만 BinaryRead 시도 If InStr(ctype, "application/json")>0 Or InStr(ctype, "text/")>0 Or InStr(ctype, "application/xml")>0 Or InStr(ctype, "application/vnd.api+json")>0 Then If Request.TotalBytes > 0 Then On Error Resume Next Dim bin, stm bin = Request.BinaryRead(Request.TotalBytes) ' 이미 Form을 썼다면 여기서 0206 발생 If Err.Number = 0 Then Set stm = Server.CreateObject("ADODB.Stream") stm.Type = 1 : stm.Open : stm.Write bin stm.Position = 0 : stm.Type = 2 : stm.Charset = "utf-8" body = stm.ReadText stm.Close : Set stm = Nothing End If Err.Clear On Error GoTo 0 End If ' HTML Form-URL-Encoded: BinaryRead 금지, 키-값으로 요약 ElseIf InStr(ctype, "application/x-www-form-urlencoded")>0 Then Dim k, s : s = "" For Each k In Request.Form ' 여기서 처음 Form을 파싱하도록 함 s = s & k & "=" & Request.Form(k) & "&" Next If Len(s) > 0 Then s = Left(s, Len(s)-1) End If body = s ' Multipart/Form-Data: 대용량/파일 포함 가능 → 요약만 ElseIf InStr(ctype, "multipart/form-data")>0 Then body = "[multipart/form-data length=" & Request.TotalBytes & " bytes]" End If ReadRequestBodySafe = body End Function %>