Flex Gateway新着情報
Governance新着情報
Monitoring API ManagerFlex Gateway新着情報
Governance新着情報
Monitoring API Manager2.x
Mule 4
3.9
1.1
2.x
1.2
7.x
fromString
fromString
MIME タイプの文字列値表現を MimeType
に変換します。
DataWeave バージョン 2.7.0 で導入されました。
名前 | 型 | 説明 |
---|---|---|
|
String (文字列) |
|
次の例では、parameters
が含まれない MIME タイプの文字列値を MimeType
値に変換します。
%dw 2.0
import * from dw::module::Mime
output application/json
---
fromString("application/json")
DataWeave
{
"success": true,
"result": {
"type": "application",
"subtype": "json",
"parameters": {}
}
}
Json
次の例では、parameters
が含まれる MIME タイプの文字列値を MimeType
値に変換します。
%dw 2.0
import * from dw::module::Mime
output application/json
---
fromString("multipart/form-data; boundary=the-boundary")
DataWeave
{
"success": true,
"result": {
"type": "multipart",
"subtype": "form-data",
"parameters": {
"boundary": "the-boundary"
}
}
}
Json
次の例では、無効な MIME タイプの文字列値を変換します。
%dw 2.0
import * from dw::module::Mime
output application/json
---
fromString("Invalid MIME type")
DataWeave
{
"success": false,
"error": {
"message": "Unable to find a sub type in `Invalid MIME type`."
}
}
Json